No errors in auth

've been working on this problem for a couple days now, and i haven’t
found out why visitors can’t sign up, but no errors are shown (through
error_messages_for).

here is my model view and controller for sign up

http://pastie.caboo.se/45992

any ideas?

you can try it to see what happens when a form is submitted,
talkingbubbles.com

Remix The wrote:

you can try it to see what happens when a form is submitted,
talkingbubbles.com

What controller/action is rendering signup.rhtml? You haven’t specified
a :url option in your form_for helper so it is POSTing the form back to
the originating action.

Try putting in something like:

<% form_for :user, :url => {:controller => “users” :action => “signup”}
do |f| -%>


Michael W.

the original output was:

Login

Email

Password

Confirm Password

i tried this

<% form_for :user, :url => {:controller => “users”, :action => “signup”}
do |f| -%>

and got this output:

Login

Email

Password

Confirm Password

it’s the same thing, but i don’t understand why validation always fails,
and the form doesn’t save, or return errors (via error_messages_for
:user)

Michael W. wrote:

Remix The wrote:

you can try it to see what happens when a form is submitted,
talkingbubbles.com

What controller/action is rendering signup.rhtml? You haven’t specified
a :url option in your form_for helper so it is POSTing the form back to
the originating action.

Try putting in something like:

<% form_for :user, :url => {:controller => “users” :action => “signup”}
do |f| -%>


Michael W.

Remix The wrote:

if i comment out rescue, this is what i get:

ActiveRecord::RecordInvalid in UsersController#signup

Validation failed:

[…]

Request

Parameters: {“commit”=>“Sign up”, “password_confirmation”=>“mine”,
“password”=>“mine”, “login”=>“testing”, “email”=>“testing”}

does this give any clues as to why validation is not passing?

I don’t know what your table definition looks like so at this point I
would suggest stripping out the validations from your model until you
find the one(s) that is triggering the error.


Michael W.

Michael W. wrote:

I don’t know what your table definition looks like so at this point I
would suggest stripping out the validations from your model until you
find the one(s) that is triggering the error.


Michael W.

i commented out all validations… same thing, no difference… maybe
the ‘problem’ occurs before this?

theRemix wrote:

Michael W. wrote:

I don’t know what your table definition looks like so at this point I
would suggest stripping out the validations from your model until you
find the one(s) that is triggering the error.

i commented out all validations… same thing, no difference… maybe
the ‘problem’ occurs before this?

I would dump out the contents of params[:user] to your log file and see
if there’s something funny in there. E.g.:

def signup
logger.debug(params[:user].inspect)
@user = User.new(params[:user])
logger.debug(@user.inspect)

This assumes you are running development mode. You’ll need to use
another logger level if you are running in production (like
logger.warn).


Michael W.

Michael W. wrote:

theRemix wrote:

Michael W. wrote:

I don’t know what your table definition looks like so at this point I
would suggest stripping out the validations from your model until you
find the one(s) that is triggering the error.

i commented out all validations… same thing, no difference… maybe
the ‘problem’ occurs before this?

I would dump out the contents of params[:user] to your log file and see
if there’s something funny in there. E.g.:

def signup
logger.debug(params[:user].inspect)
@user = User.new(params[:user])
logger.debug(@user.inspect)

This assumes you are running development mode. You’ll need to use
another logger level if you are running in production (like
logger.warn).


Michael W.

Processing UsersController#signup (for 127.0.0.1 at 2007-03-11 04:36:26)
[POST]
Session ID: 311060b70cf8ee0f1909a2159b21a6e0
Parameters: {“commit”=>“Sign up”, “password_confirmation”=>“mine”,
“action”=>“signup”, “controller”=>“users”, “login”=>“help”,
“password”=>“mine”, “email”=>“please”}
User Columns (0.000718) SHOW FIELDS FROM users
User Load (0.000271) SELECT * FROM users ORDER BY created_at DESC
LIMIT 5
Dream Columns (0.000615) SHOW FIELDS FROM dreams
Dream Load (0.000219) SELECT * FROM dreams WHERE (dreams.deleted_at
IS NULL OR dreams.deleted_at > ‘2007-03-11 04:36:26’) ORDER BY
comments_count desc LIMIT 5
nil
#<User:0x2ad0c96b1f10 @attributes={“salt”=>nil, “city”=>nil,
“name”=>nil, “updated_at”=>nil, “zip”=>nil, “crypted_password”=>nil,
“remember_token_expires_at”=>nil, “country”=>nil, “remember_token”=>nil,
“login”=>nil, “created_at”=>nil, “state”=>nil, “email”=>nil},
@new_record=true>
SQL (0.000038) BEGIN
SQL (0.000032) ROLLBACK
Rendering actionsignuplayoutfalse within layouts/default
Rendering users/signup
Rendered layouts/_signup (0.00011)
Comment Columns (0.000586) SHOW FIELDS FROM comments
Rendered layouts/_footer (0.00029)
Completed in 0.02685 (37 reqs/sec) | Rendering: 0.00775 (28%) | DB:
0.00248 (9%) | 200 OK [http://localhost/users/signup]

if i comment out rescue, this is what i get:

ActiveRecord::RecordInvalid in UsersController#signup

Validation failed:

RAILS_ROOT: script/…/config/…

/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/validations.rb:764:in
save_without_transactions!' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:133:insave!’
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
transaction' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:95:intransaction’
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:121:in
transaction' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:133:insave!’
app/controllers/users_controller.rb:36:in `signup’

/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/validations.rb:764:in
save_without_transactions!' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:133:insave!’
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
transaction' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:95:intransaction’
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:121:in
transaction' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:133:insave!’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:1095:in
send' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:1095:inperform_action_without_filters’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:632:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:in
call' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:incall’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:in
call' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:incall’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:619:inperform_action_without_benchmark’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue' /usr/lib64/ruby/1.8/benchmark.rb:293:inmeasure’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/benchmarking.rb:66:in
perform_action_without_rescue' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/rescue.rb:83:inperform_action’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:430:in
send' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:430:inprocess_without_filters’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:624:in
process_without_session_management_support' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/session_management.rb:114:inprocess’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:330:in
process' /usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:41:indispatch’
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:113:in
handle_dispatch' /usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:79:inservice’
/usr/lib64/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/lib64/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/lib64/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/lib64/ruby/1.8/webrick/server.rb:162:instart’
/usr/lib64/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/lib64/ruby/1.8/webrick/server.rb:95:instart’
/usr/lib64/ruby/1.8/webrick/server.rb:92:in each' /usr/lib64/ruby/1.8/webrick/server.rb:92:instart’
/usr/lib64/ruby/1.8/webrick/server.rb:23:in start' /usr/lib64/ruby/1.8/webrick/server.rb:82:instart’
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:63:in
dispatch' /usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/webrick.rb:59 /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in require' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:inrequire’
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:343:in
new_constants_in' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:inrequire’
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in
require' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:343:innew_constants_in’
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in
`require’
script/server:3

/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/validations.rb:764:in
save_without_transactions!' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:133:insave!’
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in
transaction' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:95:intransaction’
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:121:in
transaction' /usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/transactions.rb:133:insave!’
app/controllers/users_controller.rb:36:in signup' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:1095:insend’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:1095:in
perform_action_without_filters' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:632:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:incall’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:in
call' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:incall’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:in
call_filter' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:638:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:438:in
call' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:637:incall_filter’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:619:in
perform_action_without_benchmark' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
/usr/lib64/ruby/1.8/benchmark.rb:293:in measure' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/benchmarking.rb:66:inperform_action_without_rescue’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/rescue.rb:83:in
perform_action' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:430:insend’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:430:in
process_without_filters' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/filters.rb:624:inprocess_without_session_management_support’
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/session_management.rb:114:in
process' /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.1/lib/action_controller/base.rb:330:inprocess’
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/dispatcher.rb:41:in
dispatch' /usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:113:inhandle_dispatch’
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:79:in
service' /usr/lib64/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/lib64/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/lib64/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/lib64/ruby/1.8/webrick/server.rb:162:in start' /usr/lib64/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/lib64/ruby/1.8/webrick/server.rb:95:in start' /usr/lib64/ruby/1.8/webrick/server.rb:92:ineach’
/usr/lib64/ruby/1.8/webrick/server.rb:92:in start' /usr/lib64/ruby/1.8/webrick/server.rb:23:instart’
/usr/lib64/ruby/1.8/webrick/server.rb:82:in start' /usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/webrick_server.rb:63:indispatch’
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/servers/webrick.rb:59
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in
require' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:343:innew_constants_in’
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:in
require' /usr/lib64/ruby/gems/1.8/gems/rails-1.2.1/lib/commands/server.rb:39 /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in require' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:inrequire’
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:343:in
new_constants_in' /usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.0/lib/active_support/dependencies.rb:496:inrequire’
script/server:3

Request

Parameters: {“commit”=>“Sign up”, “password_confirmation”=>“mine”,
“password”=>“mine”, “login”=>“testing”, “email”=>“testing”}

does this give any clues as to why validation is not passing?

theRemix … wrote:


LIMIT 5
SQL (0.000038) BEGIN
SQL (0.000032) ROLLBACK
Rendering actionsignuplayoutfalse within layouts/default
Rendering users/signup
Rendered layouts/_signup (0.00011)
Comment Columns (0.000586) SHOW FIELDS FROM comments
Rendered layouts/_footer (0.00029)
Completed in 0.02685 (37 reqs/sec) | Rendering: 0.00775 (28%) | DB:
0.00248 (9%) | 200 OK [http://localhost/users/signup]

commit and password_confirmation are not part of the model and so
User.new is
failing. Delete those keys out of params[:user] or don’t store them in
params[:user] when you create the form or set the the attributes
manually. E.g.:

@user = User.new
@user.login = params[:user][:login]
@user.email = params[:user][:email]

or

@user = User.new(:login => params[:user][:login],
:email => params[:user][:login], …)


Michael W.

theRemix … wrote:

Rendered layouts/_footer (0.00029)
@user.email = params[:user][:email]

self.current_user = @user
redirect_back_or_default(:controller => '/', :action => 'index')
flash[:notice] = "Thanks for signing up!"

rescue ActiveRecord::RecordInvalid
render :action => ‘signup’
end

same result, validation fails

Why are you using params[:login] instead of params[:user][:login]? Did
you
change your form? Which validation is it failing on?


Michael W.

Michael W. wrote:

theRemix … wrote:


LIMIT 5
SQL (0.000038) BEGIN
SQL (0.000032) ROLLBACK
Rendering actionsignuplayoutfalse within layouts/default
Rendering users/signup
Rendered layouts/_signup (0.00011)
Comment Columns (0.000586) SHOW FIELDS FROM comments
Rendered layouts/_footer (0.00029)
Completed in 0.02685 (37 reqs/sec) | Rendering: 0.00775 (28%) | DB:
0.00248 (9%) | 200 OK [http://localhost/users/signup]

commit and password_confirmation are not part of the model and so
User.new is
failing. Delete those keys out of params[:user] or don’t store them in
params[:user] when you create the form or set the the attributes
manually. E.g.:

@user = User.new
@user.login = params[:user][:login]
@user.email = params[:user][:email]

or

@user = User.new(:login => params[:user][:login],
:email => params[:user][:login], …)


Michael W.

hmmm… i’m surprised to say that nothing has changed… i really thought
that’s where i went wrong.

def signup
@user = User.new( :login => params[:login],
:email => params[:email],
:password => params[:password],
:password_confirmation => params[:password_confirmation])
return unless request.post?
@user.save!
self.current_user = @user
redirect_back_or_default(:controller => ‘/’, :action => ‘index’)
flash[:notice] = “Thanks for signing up!”
rescue ActiveRecord::RecordInvalid
render :action => ‘signup’
end

same result, validation fails