Method: Trust::Controller::Properties#actions
- Defined in:
- lib/trust/controller/properties.rb
#actions(options) ⇒ Object
Specify actions to handle
Options
:new => actions # specify new actions - default id :new, :create
:member => actions # specify member actions - default is :show, :edit, :update, :destroy
:collection => actions # specify collection actions - default is :index
:except => actions # removes any standard actions
:only => actions # selects only the standard actions specifiec
:add => {options} # to add options, eg :add => {:new => :confirm}
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/trust/controller/properties.rb', line 130 def actions() if add = [:add] self.new_actions += Array.wrap(add[:new]) if add[:new] self.member_actions += Array.wrap(add[:member]) if add[:member] self.collection_actions += Array.wrap(add[:collection]) if add[:collection] end self.new_actions = Array.wrap([:new]) if [:new] self.member_actions = Array.wrap([:member]) if [:member] self.collection_actions = Array.wrap([:collection]) if [:collection] if [:only] only = Array.wrap([:only]) self.new_actions &= only self.member_actions &= only self.collection_actions &= only end if [:except] except = Array.wrap([:except]) self.new_actions -= except self.member_actions -= except self.collection_actions -= except end end |