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@googlegroups.com.
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.

Search Discussions

  • Romain 'Maz' BILLOIR at Sep 18, 2011 at 11:15 am
    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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 17, '11 at 10:57p
activeSep 18, '11 at 11:15a
posts2
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Romain 'Maz' BILLOIR: 2 posts

People

Translate

site design / logo © 2021 Grokbase