Module: Prefab::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/prefab/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
15 16 17 18 19 20 21 |
# File 'lib/prefab/controller.rb', line 15 def create if resource.save redirect_to resource, notice: else render :new, alert: end end |
#destroy ⇒ Object
31 32 33 34 |
# File 'lib/prefab/controller.rb', line 31 def destroy resource.destroy! redirect_back(fallback_location: root_path) end |
#edit ⇒ Object
13 |
# File 'lib/prefab/controller.rb', line 13 def edit; end |
#index ⇒ Object
10 |
# File 'lib/prefab/controller.rb', line 10 def index; end |
#new ⇒ Object
12 |
# File 'lib/prefab/controller.rb', line 12 def new; end |
#show ⇒ Object
11 |
# File 'lib/prefab/controller.rb', line 11 def show; end |
#update ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/prefab/controller.rb', line 23 def update if resource.update(resource_params) redirect_to resource, notice: else render :edit, alert: end end |