Hi, i''ve got some troubles using Authlogic: i generated users database, created the first user which will be superadmin(can''t be delete and can''t be modified by another user). Then to optimize my application, i delete show method and route, add and remove some part of rails code in my controllers/views files i don''t need anymore. And now, i can create/update user, but the password i write isn''t saved in the database. The fields crypted_password and password_salt are blank. This is my usercontroller: def create @user = User.new(params[:user]) if @user.save redirect_to admin_users_url, :notice => "Successfully created user." else render :action => ''new'' end end def update if params[:id] != 1 or current_user.id == 1 @user = User.find_by_id(params[:id]) if @user.update_attributes(params[:user]) redirect_to admin_users_url, :notice => "Successfully updated user." else render :action => ''edit'' end end end I used find_by_id because find(params[:id]) is calling a Postgresql and HTTP500 Error: User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" 1 LIMIT 1 CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", "11"]] PGError: ERREUR: le plan en cache ne doit pas modifier le type en résultat : SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 Completed 500 Internal Server Error in 81ms My user model: class User < ActiveRecord::Base acts_as_authentic attr_accessor :password, :password_confirmation end Thanks for any help. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Romain ''Maz'' BILLOIR
2011-Sep-18 11:15 UTC
Re: Authlogic saves users with blank password.
Ok, just fixed the issue: in my model the right syntax was "attr_accessible", everything works fine now. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.