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.
57c6a3276ed9cbb3b271e5dd067f0724?d=identicon&s=25 Indu R Nair (indu)
on 2009-03-19 07: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
79ad5a1770c5cf086735a10ef7db6598?d=identicon&s=25 Vojto (Guest)
on 2009-03-19 07: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 <rails-mailing-l...@andreas-s.net>
57c6a3276ed9cbb3b271e5dd067f0724?d=identicon&s=25 Indu R Nair (indu)
on 2009-03-19 08: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 <rails-mailing-l...@andreas-s.net>
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?
79ad5a1770c5cf086735a10ef7db6598?d=identicon&s=25 Vojto (Guest)
on 2009-03-19 20:58
(Received via mailing list)
Give us the context of where the error is getting raised.

On 19. Mar., 08:07 h., Indu RS <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.