Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #this does work, but i do not know if the push fails
- def create
- comment = Comment.new(:text => params[:text])
- @item.comments << comment
- render :text => comment
- end
- #this does not work
- def create
- comment = Comment.new(:text => params[:text])
- if @item.comments << comment
- render :text => comment
- else
- render :text => 'oh no'
- end
- end
- #this does not work
- def create
- begin
- comment = Comment.new(:text => params[:text])
- @item.comments << comment
- render :text => comment
- rescue Exception => e
- render :text => 'oh no'
- end
- end
- def create
- comment = Comment.new(:text => params[:text])
- comment.item = @item
- if comment.save
- render :text => "yay"
- else
- render :text => "oh no"
- end
- end
Add Comment
Please, Sign In to add comment