Hai everyone, I am using restful_authentication plugin in my project. The relation between the category and user is has_and_belongs_to_many. So I created another table category_users with category_id and user_id as fields. In my view i specified like the following. <% for category in Category.find(:all) %> <%= category.name %> <%= check_box_tag("user[category_ids][]","#{category.id}") %> <%end%> But when I tried to save the user model the categories of the user is not saving in the table category_users. Data to the table users is saving. What I have to do for storing data to category_users? (more than one category for a single user). Please help. Thanks in advance -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Try to load up script/console, and check if user.category_ids[1,3,6,...] works .. On 19. Mar., 07:38 h., Indu RS <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hai everyone, > I am using restful_authentication plugin in my project. The relation > between the category and user is has_and_belongs_to_many. So I created > another table category_users with category_id and user_id as fields. In > my view i specified like the following. > <% for category in Category.find(:all) %> > <%= category.name %> > <%= check_box_tag("user[category_ids][]","#{category.id}") > %> > <%end%> > But when I tried to save the user model the categories of the user is > not saving in the table category_users. Data to the table users is > saving. What I have to do for storing data to category_users? (more than > one category for a single user). > Please help. > Thanks in advance > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Vojto wrote:> Try to load up script/console, and check if user.category_ids> [1,3,6,...] works .. > > On 19. Mar., 07:38 h., Indu RS <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Thanks for the immediate reply. Solve the issue by adding attr_accessible :category_ids in the model. But another error is coming ie undefined method `to_sym'' for #<State:0x665cc04> installed the plugin with --include-activation and --stateful options. I dont'' understand the reason for that. Pls help. Any suggestions for a good documentation of using the restful_authentication plugin? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Give us the context of where the error is getting raised. On 19. Mar., 08:07 h., Indu RS <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Vojto wrote: > > Try to load up script/console, and check if user.category_ids> > [1,3,6,...] works .. > > > On 19. Mar., 07:38 h., Indu RS <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > Thanks for the immediate reply. > > Solve the issue by adding attr_accessible :category_ids in the model. > But another error is coming ie > undefined method `to_sym'' for #<State:0x665cc04> > installed the plugin with --include-activation and --stateful options. > I dont'' understand the reason for that. Pls help. > Any suggestions for a good documentation of using the > restful_authentication plugin? > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---