Created
February 2, 2012 16:04
-
-
Save djgraham/1724238 to your computer and use it in GitHub Desktop.
Really hacky way of assigning a "belongs_to" event with an attribute on the event that is allowed to change on create or update of a comment :/
This file contains 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
def create | |
@event.update_attribute(:status_id, params[:comment][:event_attributes][:status_id]) | |
params[:comment].delete(:event_attributes) # = nil # = {:id => params[:event_id]} | |
@comment = @event.comments.new(params[:comment]) | |
if @comment.save | |
redirect_to admin_event_comments_path(@event), :flash => { :info => "Comment created" } | |
else | |
render :action => :edit | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment