Class: Admin::DiscussionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::DiscussionsController
- Defined in:
- app/controllers/cornerstone/admin/discussions_controller.rb
Instance Method Summary collapse
-
#edit ⇒ Object
GET /cornerstone/admin/discussions/:id/edit.
-
#update ⇒ Object
PUT /cornersone/admin/discussions/:id.
Instance Method Details
#edit ⇒ Object
GET /cornerstone/admin/discussions/:id/edit
7 8 9 10 11 |
# File 'app/controllers/cornerstone/admin/discussions_controller.rb', line 7 def edit @discussion = Discussion.includes(:posts => :user).find(params[:id]) @categories = Category.discussions respond_with(:admin, @discussion) end |
#update ⇒ Object
PUT /cornersone/admin/discussions/:id
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/cornerstone/admin/discussions_controller.rb', line 14 def update @discussion = Discussion.includes(:posts => :user).find(params[:id]) respond_with(@discussion.category, @discussion) do |format| if @discussion.update_attributes(params[:discussion]) flash[:notice] = "Discussion was successfully updated." format.html {redirect_to category_discussion_path(@discussion.category, @discussion)} else @categories = Category.discussions format.html {render :edit} end end end |