Class: JournalsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- JournalsController
- Defined in:
- lib/app/controllers/journals_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
21 22 23 24 25 |
# File 'lib/app/controllers/journals_controller.rb', line 21 def create @journal = @calendar.journals.create(params[:journal]) flash[:notice] = "Journal successfully created" if @journal.save respond_with(@calendar, @journal) end |
#destroy ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/app/controllers/journals_controller.rb', line 33 def destroy @journal = @calendar.journals.find(params[:id]) @journal.destroy respond_to do |format| format.html { redirect_to(calendars_journals_url(@calendar, @journal)) } format.xml { head :ok } end end |
#edit ⇒ Object
17 18 19 |
# File 'lib/app/controllers/journals_controller.rb', line 17 def edit respond_with(@calendar, (@journal = @calendar.journals.find(params[:id]))) end |
#index ⇒ Object
5 6 7 |
# File 'lib/app/controllers/journals_controller.rb', line 5 def index respond_with(@calendar, (@journals = @calendar.journals.all)) end |
#new ⇒ Object
13 14 15 |
# File 'lib/app/controllers/journals_controller.rb', line 13 def new respond_with(@calendar, (@journal = @calendar.journals.new)) end |
#show ⇒ Object
9 10 11 |
# File 'lib/app/controllers/journals_controller.rb', line 9 def show respond_with(@calendar, (@journal = @calendar.journals.find(params[:id]))) end |
#update ⇒ Object
27 28 29 30 31 |
# File 'lib/app/controllers/journals_controller.rb', line 27 def update @journal = @calendar.journals.find(params[:id]) @journal.update_attributes(params[:calendar]) respond_with(@calendar, @journal) end |