Class: Maeku::EntriesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Maeku::EntriesController
- Defined in:
- app/controllers/maeku/entries_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
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/maeku/entries_controller.rb', line 25 def create @entry = Entry.new(entry_params) @entry. = .id if @entry.save flash[:notice] = I18n.t 'controller.entries.create.success' redirect_to @entry else flash[:error] = I18n.t 'controller.entries.create.error' render :new end end |
#destroy ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/maeku/entries_controller.rb', line 48 def destroy @entry = Entry.find(params[:id]) if @entry.destroy flash[:notice] = I18n.t 'controller.entries.destroy.success' redirect_to entries_url else flash[:error] = I18n.t 'controller.entries.destroy.error' redirect_to entries_url end end |
#edit ⇒ Object
18 19 20 21 22 23 |
# File 'app/controllers/maeku/entries_controller.rb', line 18 def edit unless flash[:error] = I18n.t 'controller.entries.edit.error' redirect_to entries_url end end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/maeku/entries_controller.rb', line 7 def index @entries = .entries end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/maeku/entries_controller.rb', line 14 def new @entry = Entry.new end |
#show ⇒ Object
11 12 |
# File 'app/controllers/maeku/entries_controller.rb', line 11 def show end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/maeku/entries_controller.rb', line 38 def update if @entry.update(entry_params) && flash[:notice] = I18n.t 'controller.entries.update.success' redirect_to @entry else flash[:error] = I18n.t 'controller.entries.update.error' render :edit end end |