On Fri, Jun 11, 2010 at 5:37 PM, Max You <[email protected]> wrote:
> Hi, I have a problem passing parameters via post.
> post_params="name="+name+"¬es="+notes+"&parent_nid="+parent_nid+"&authenticity_token="+window._token;
...
> the log part:
> Parameters: {"name"=>"abc",
> "authenticity_token"=>"d8c79e2216df723f373a9170fa364f9a3c147092",
> "notes"=>"abcde", "parent_nid"=>"0"}
The parameters aren't nested properly, you want.
{ "category" => {"name"=>"abc", "notes" => "abcde", "parent_nid" => "0"},
"authenticity_token"=>"d8c79e2216df723f373a9170fa364f9a3c147092"
}
I also suspect that the parent_nid attribute of category probably
should be parent_id (based on convention assuming that
a category belongs_to :parent)
So I think you want something like this javascript:
post_params="category[name]="+name+"&category[notes]="+notes+"&category[parent_id]="+parent_nid+"&authenticity_token="+window._token;
HTH
--
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Github: http://github.com/rubyredrick
Twitter: @RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.