Ruby on Rails Friday, November 27, 2015

On 27 November 2015 at 01:57, fugee ohu <fugee279@gmail.com> wrote:
> I'm able to follow the docs and create categorie from the rails console but
> I'm having trouble working those instructions into my controller I know this
> is wrong I dunno if I can use category instead of @category for the object
> The browser returns syntax error for the respond to do |format| line
> unexpected identifier
>
> # POST /categories
> # POST /categories.json
> def create
> category = Category.new(category_params)
> parent=Category.find(#{params[:parent_id]})
> category.move_to_child_of(parent)
>
> respond_to do |format|
> if cat.save

I don't see anything wrong with the respond_to line, but what is the
variable cat? I would not have expected that to give a syntax error
though. Copy/paste the full error and stack from the server window
here. Make sure to tell us which line is the one referred to in the
error.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLvpuedNDk75nT0xh7DKcaPDbQ93vafFjQOo%2BwWKcHpEow%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment