Hi I am trying to implement restful_authentication plugin in my rails application. But my user model contains extra fields like country_id, state_id, city_id, phone_number, status_id, gender etc. Is it possible to add additional fields along with restful_authentication plugin? I was not able to store the additional fields. pls help. very urgent. This is my first project in ROR 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 -~----------~----~----~----~------~----~------~--~---
On Wed, 18 Mar 2009 14:44:33 +0100 Indu RS <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am trying to implement restful_authentication plugin in my rails > application. But my user model contains extra fields like country_id, > state_id, city_id, phone_number, status_id, gender etc. Is it possible > to add additional fields along with restful_authentication plugin? I was > not able to store the additional fields. pls help. very urgent. This is > my first project in RORYou''ll need to make a migration to add the extra columns to your users table. restful_authentication generates a user model/views/controller. So you can edit those to accept your extra fields. SH -- Starr Horne Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The best option would be to create a user_profile and have the user has_one :profile, :class_name => ''user_profile''. If you have to have it in the user class you have to add them here: attr_accessible :login, :email, :password, :password_confirmation, :security_question, :extra_fields Thats what I''m guessing but I guess it depends on the error... Did you add the extra fields using migration? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Starr Horne wrote:> On Wed, 18 Mar 2009 14:44:33 +0100 > Indu RS <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> I am trying to implement restful_authentication plugin in my rails >> application. But my user model contains extra fields like country_id, >> state_id, city_id, phone_number, status_id, gender etc. Is it possible >> to add additional fields along with restful_authentication plugin? I was >> not able to store the additional fields. pls help. very urgent. This is >> my first project in ROR > > You''ll need to make a migration to add the extra columns to your users > table. restful_authentication generates a user model/views/controller. > So you can edit those to accept your extra fields. > > SH > > -- > Starr Horne > Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/Thanks for the reply. Created the migration and added extra fields. The error coming at the time of saving the data to the user model. ie I am not getting the values in the insert query (got the insert statement from the log file).I am getting "null" for the extra fields in the insert query -- 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 -~----------~----~----~----~------~----~------~--~---
On Wed, 18 Mar 2009 15:34:59 +0100 Indu RS <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Created the migration and added extra fields. The error coming at the > time of saving the data to the user model. ie I am not getting the > values in the insert query (got theAre you sure you''re passing the extra fields to the model? Have you tried opening a console and manually creating a user model? That would tell you if the problem''s in your model or in your controller/view SH -- Starr Horne Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> -- > Starr Horne > Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/Thanks again Yes , I am sure, that I am passing the extra fields to the model. -- 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 -~----------~----~----~----~------~----~------~--~---
On Wed, 18 Mar 2009 15:51:34 +0100 Indu RS <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Yes , I am sure, that I am passing the extra fields to the model.Hmm, well it should work then :) It might be useful for you to post some code. SH -- Starr Horne Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks for your valuable help. My view code is <% form_for @user ,:html => { :multipart => true } do |f| -%> <table> <tr> <td>*</td> <td>Username</td> <td><%= f.text_field :login%></td> </tr> <tr> <td>*</td> <td>First Name</td> <td><%= f.text_field :name%> </td> </tr> <tr> <td>*</td> <td>E mail</td> <td><%= f.text_field :email%></td> </tr> <tr> <td>*</td> <td>Password</td> <td><%= f.password_field :password %></td> </tr> <tr> <td>*</td> <td>Password</td> <td><%= f.password_field :password_confirmation %></td> </tr> <tr> <td>*</td> <td>Country</td> <td><%= f.select(:country_id,Country.find(:all).collect{|c|[c.name,c.id] },:prompt=>''Select Country'')%></td> </tr> ........ <% end %> and in my controller users_contrller in the new @user = User.new and in create actions I just wrote @user.save. The error coming in country_id cant'' be null. since I had given the database constraint that null value is not allowed. while i am looking the insert statement in place of country_id value is null. but when I tried to print the params[:user][:country_id] the value is getting. Pls help. since I had spend more time and still vein . -- 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 -~----------~----~----~----~------~----~------~--~---
What is the error that you get? Does it say you are not allowed to mass assign this (country_id) variable? Have a look in your user model where you have the attr_accessible you are going to have to add :country_id there. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Freddy Andersen wrote:> What is the error that you get? Does it say you are not allowed to > mass assign this (country_id) variable? > > Have a look in your user model where you have the attr_accessible you > are going to have to add :country_id there.Thank you so much for the immediate replay and solved my issue -- 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 -~----------~----~----~----~------~----~------~--~---