Hi to everybody, well i recently became a RoR developer, web i was
following the video class from Lynda, and i introduce more code in my
aplicacion, my application is a music store web site, ok so i add the
funcionality of add clients, for that i need from my client, his user
and password, so it will be 1 user per client, for that reason i use at
my model

validates_uniqueness_of :user

############## here is my model ###########3
class Customer < ActiveRecord::Base

    has_many :orders
  attr_accessible :first_name,:last_name,
:zip_code,:user,:hashed_password

   validates_uniqueness_of :user

##########################################

and when i run the application
  and want to add a diferent user from those are exist it work fine,
  bue when i want to add a user that is already add db it blow up
and apears this :
/////////////////////7777
 ArgumentError in CustomersController#create

     too few arguments

app/controllers/customers_controller.rb:71:in `format'
app/controllers/customers_controller.rb:71:in `create'
////////////////////////77

ok so, what i found there was
70> flash[:notice] = 'Error!!!! intentelo de nuevo'
 71>   format.html { render :action => "new" }
 72>  format.xml  { render :xml => @customer.errors, :status =>
:unprocessable_entity }

################
i change those , the first line for
70> flash[:notice] = 'Error!!!! intentelo de nuevo'
71> redirect_to (:action => 'new' )
### with this change i fix the problem, but, nothing appear i mean the
message from the validates_uniqueness_of   , it should appear that the
user is already in use or something similar.

Anyone can help me ?!?!!
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to