weird devise/rails issue not sending username -
i have added username devise authentication setup, , reason, it's not inserting username database. database puts null in username field.
i have included code migration, , form, production log shows sent actual username.
here did:
so added migration add username, successful:
class addusernametousers < activerecord::migration def self.up add_column :users, :username, :string end def self.down remove_column :users, :username end end
i edited app/views/devise/registrations/new.html.erb include text field username:
<h2>sign up</h2> <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) |f| %> <%= devise_error_messages! %> <p><%= f.label :username %><br /> <%= f.text_field :username %></p> <p><%= f.label :email %><br /> <%= f.text_field :email %></p> <p><%= f.label :password %><br /> <%= f.password_field :password %></p> <p><%= f.label :password_confirmation %><br /> <%= f.password_field :password_confirmation %></p> <p><%= f.submit "sign up" %></p> <% end %> <%= render :partial => "devise/shared/links" %>
here production log if helps:
started post "/users" 136.152.162.173 @ wed feb 23 12:46:12 -0800 2011 processing devise::registrationscontroller#create html parameters: {"commit"=>"sign up", "authenticity_token"=>"k8m6em7iqstfqg8aaye4faumsl2e46unallntcsef08=", "utf8"=>"?~\~s", "user"=>{"password_confirmation"=>"[filtered]", "username"=>"pyramation", "password"=>"[filtered]", "email"=>"dan@email.com"}} rendered devise/mailer/confirmation_instructions.html.erb (1.1ms)
any appreciated!
have added :username attr_accessible list in user model? e.g.:
attr_accessible :email, :password, :password_confirmation, :username
Comments
Post a Comment