Project

roda-rails

0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
roda-rails offers integration for Roda when used as Rack middleware in a Rails application. It allows the Roda middleware to use Rails flash handling as well as Rails' CSRF support.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.2.0
>= 2
 Project Readme

roda-rails¶ ↑

roda-rails offers integration for Roda when used as Rack middleware in a Rails application. It allows the Roda middleware to use Rails flash handling as well as Rails’ CSRF support. Roda by default integrates with Rails’ session support, since that just uses the standard Rack session protocol.

Currently, only support for Rails 4.2 is included. Pull requests for other Rails versions will be considered, in the form of a separate plugin per Rails minor version.

Currently, there are no automated tests. If you decide to use this in production, it may be a good idea to write automated tests for it and submit a pull request.

Installation¶ ↑

gem install roda-rails

Source Code¶ ↑

Source code is available on GitHub at github.com/jeremyevans/roda-rails

Usage¶ ↑

roda-rails currently includes a rails42 plugin, which you can load just like any other Roda plugin:

plugin :rails42

The following plugin options are supported:

:check_csrf

A callable object that accepts the RodaRequest instance and returns whether the CSRF token should be checked. The default is to check all non-GET requests.

:invalid_csrf

A callable object for the action to taken on an invalid CSRF token. The default is to set a 400 response status and halt.

:csrf_key

A callable object for how to get the submitted CSRF token. The default is to get it from the authenticity_token request parameter.

Methods offered:

csrf_tag

Return a string containing a hidden input tag containing the CSRF token.

flash

The Rails flash object associated with the current session.

License¶ ↑

MIT

Author¶ ↑

Jeremy Evans <code@jeremyevans.net>