Class: Shoulda::Controller::ResourceOptions::DeniedOptions
- Inherits:
-
Object
- Object
- Shoulda::Controller::ResourceOptions::DeniedOptions
- Defined in:
- lib/shoulda/controller/resource_options.rb
Overview
Configuration options for the denied actions under should_be_restful
Example:
context "The public" do
setup do
@request.session[:logged_in] = false
end
should_be_restful do |resource|
resource.parent = :user
resource.denied.actions = [:index, :show, :edit, :new, :create, :update, :destroy]
resource.denied.flash = /get outta here/i
resource.denied.redirect = 'new_session_url'
end
end
Instance Attribute Summary collapse
-
#actions ⇒ Object
Actions that should be denied (only used by resource.denied).
-
#flash ⇒ Object
String or Regexp describing a value expected in the flash.
-
#redirect ⇒ Object
String evaled to get the target of the redirection.
Instance Attribute Details
#actions ⇒ Object
Actions that should be denied (only used by resource.denied). Note that these actions will only be tested if they are also listed in resource.actions
The special value of :all will deny all of the REST actions.
104 105 106 |
# File 'lib/shoulda/controller/resource_options.rb', line 104 def actions @actions end |
#flash ⇒ Object
String or Regexp describing a value expected in the flash. Will match against any flash key.
Example:
resource.create.flash = /created/
99 100 101 |
# File 'lib/shoulda/controller/resource_options.rb', line 99 def flash @flash end |
#redirect ⇒ Object
String evaled to get the target of the redirection. All of the instance variables set by the controller will be available to the evaled code.
Example:
resource.create.redirect = "user_url(@user.company, @user)"
93 94 95 |
# File 'lib/shoulda/controller/resource_options.rb', line 93 def redirect @redirect end |