Module: TypicalSituation::Actions
- Defined in:
- lib/typical_situation/actions.rb
Overview
Standard REST/CRUD actions.
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
50 51 52 53 54 55 |
# File 'lib/typical_situation/actions.rb', line 50 def create raise TypicalSituation::ActionForbidden unless (:create) @resource = create_resource(create_params) respond_as_created end |
#destroy ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/typical_situation/actions.rb', line 42 def destroy get_resource raise TypicalSituation::ActionForbidden unless (:destroy, @resource) destroy_resource(@resource) respond_as_gone end |
#edit ⇒ Object
20 21 22 23 24 25 |
# File 'lib/typical_situation/actions.rb', line 20 def edit get_resource raise TypicalSituation::ActionForbidden unless (:edit, @resource) respond_with_resource end |
#index ⇒ Object
6 7 8 9 10 11 |
# File 'lib/typical_situation/actions.rb', line 6 def index raise TypicalSituation::ActionForbidden unless (:index) get_resources respond_with_resources end |
#new ⇒ Object
27 28 29 30 31 32 |
# File 'lib/typical_situation/actions.rb', line 27 def new raise TypicalSituation::ActionForbidden unless (:new) new_resource respond_with_resource end |
#show ⇒ Object
13 14 15 16 17 18 |
# File 'lib/typical_situation/actions.rb', line 13 def show get_resource raise TypicalSituation::ActionForbidden unless (:show, @resource) respond_with_resource end |
#update ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/typical_situation/actions.rb', line 34 def update get_resource raise TypicalSituation::ActionForbidden unless (:update, @resource) update_resource(@resource, update_params) respond_as_changed end |