Re: [Rails] awesome_nested_set adding categories

7 views
Skip to first unread message

Colin Law

unread,
Nov 27, 2015, 3:36:34 AM11/27/15
to Ruby on Rails: Talk
On 27 November 2015 at 01:57, fugee ohu <fuge...@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
Reply all
Reply to author
Forward
0 new messages