Created
March 16, 2012 15:09
-
-
Save radar/2050472 to your computer and use it in GitHub Desktop.
COntroller method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DiscussionRepliesController < ApplicationController | |
| before_filter :find_discussion | |
| before_filter :find_discussionreply | |
| def create | |
| @discussionreply = @discussion.discussion_reply.new(params[:discussion_reply]) | |
| if @discussion_reply.save | |
| flash[:notice] = "You replied to a discussion" | |
| redirect_to [@discussion, @discussion_reply] | |
| #redirect_to @discussion | |
| else | |
| flash[:notice] = "Unable to submit your reply" | |
| render :action => "new" | |
| end | |
| end | |
| def find_discussion_reply | |
| @discussion_reply = @discussion.discussion_reply.find(params[:id]) | |
| end | |
| private | |
| def find_discussion | |
| @discussion = Discussion.find(params[:discussion_id]) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment