Class: Flms::BlocksController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Flms::BlocksController
- Defined in:
- app/controllers/flms/blocks_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/flms/blocks_controller.rb', line 31 def create @block = Block.new(params[:block]) if @block.save redirect_to blocks_path, notice: 'Block created.' else render action: "new" end end |
#destroy ⇒ Object
49 50 51 52 |
# File 'app/controllers/flms/blocks_controller.rb', line 49 def destroy @block.destroy redirect_to blocks_path, notice: 'Block deleted' end |
#edit ⇒ Object
28 29 |
# File 'app/controllers/flms/blocks_controller.rb', line 28 def edit end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/flms/blocks_controller.rb', line 10 def index @blocks = Block.all end |
#new ⇒ Object
24 25 26 |
# File 'app/controllers/flms/blocks_controller.rb', line 24 def new @block = Block.new end |
#show ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/flms/blocks_controller.rb', line 14 def show respond_to do |format| format.plain_html { with_format('html') { render partial: 'flms/elements/block', layout: 'flms/plain_styling', locals: { block: @block, scroll_offset: 0 } } } format.html format.json { render json: @page } end end |
#update ⇒ Object
41 42 43 44 45 46 47 |
# File 'app/controllers/flms/blocks_controller.rb', line 41 def update if @block.update_attributes(params[:block]) redirect_to blocks_path, notice: 'Block was successfully updated.' else render action: "edit" end end |