Monday, August 2, 2010

[Rails] Re: simple redirect_to shows in log but doesn't redirect

On Aug 2, 2:01 pm, Neil Bye <li...@ruby-forum.com> wrote:
>
>   def create
>     @story = Story.find(params[:story_id])
>     @story.comments.create params[:comment]
>       format.js
>   end
>
> The log now says
>
> ArgumentError (too few arguments):
>   app/controllers/comments_controller.rb:12:in `format'
>   app/controllers/comments_controller.rb:12:in `create'
>
> So I think we need
>
>   def create
>     @story = Story.find(params[:story_id])
>     @story.comments.create params[:comment]
>     respond_to do |format|
>       format.js
>     end
>   end
>

i was saying you need neither -

  def create
    @story = Story.find(params[:story_id])
    @story.comments.create params[:comment]
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate