Two models with restful_authentication


#1

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


#2

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


#3

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?


#4

Give us the context of where the error is getting raised.

On 19. Mar., 08:07 h., Indu RS removed_email_address@domain.invalid