Module: Paramount::Controller
- Defined in:
- lib/paramount/controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/paramount/controller.rb', line 18 def create new if new.form(resource_params).save redirection(action: 'created') else render :new end end |
#destroy ⇒ Object
36 37 38 39 |
# File 'lib/paramount/controller.rb', line 36 def destroy resource.destroy redirect_to polymorphic_path(resource.class), notice: 'Successfully destroyed' end |
#edit ⇒ Object
14 15 16 |
# File 'lib/paramount/controller.rb', line 14 def edit resource end |
#index ⇒ Object
3 4 5 |
# File 'lib/paramount/controller.rb', line 3 def index collection end |
#new ⇒ Object
11 12 |
# File 'lib/paramount/controller.rb', line 11 def new end |
#show ⇒ Object
7 8 9 |
# File 'lib/paramount/controller.rb', line 7 def show resource end |
#update ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/paramount/controller.rb', line 28 def update if resource.form(resource_params).save redirection(action: 'updated') else render :edit end end |