Forum: Ruby on Rails Two models with restful_authentication

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Indu R. (Guest)
on 2009-03-19 08:38
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
Vojto (Guest)
on 2009-03-19 08:59
(Received via mailing list)
Try to load up script/console, and check if user.category_ids=
[1,3,6,...] works ..

On 19. Mar., 07:38 h., Indu RS <removed_email_address@domain.invalid>
Indu R. (Guest)
on 2009-03-19 09:07
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 <removed_email_address@domain.invalid>
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?
Vojto (Guest)
on 2009-03-19 21:58
(Received via mailing list)
Give us the context of where the error is getting raised.

On 19. Mar., 08:07 h., Indu RS <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.