Thanks. I think I’m still doing something wrong because I now have
validates_each :date_of_birth do |record, attr, value|
record.errors.add attr, “You must be at least 18 years old to
use this site.” if :user_type_id != 1 && value >
Date.new((Date.today.year - 18),(Date.today.month),(Date.today.day))
end
but I’m getting an error upon trying to create my object. The error
is
NoMethodError in Super admin/subscriberController#create
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.>
app/models/user.rb:10
app/controllers/super_admin/subscriber_controller.rb:43:in `create’
Request
Parameters:
{“user”=>{“pharmacy_id”=>“333”,
“work_phone_extension”=>“”,
“credit_card_number”=>“”,
“user_type_id”=>“1”,
“ship_to_last_name”=>“Alvarado”,
“ship_to_city”=>“Denver”,
“credit_card_expiration_date(1i)”=>“2008”,
“credit_card_expiration_date(2i)”=>“9”,
“ship_to_country”=>“US”,
“password_confirmation”=>“password”,
“credit_card_security_code”=>“”,
“ship_to_street”=>“1201 Galapago “,
“ship_to_zip”=>“80204”,
“credit_card_expiration_date(3i)”=>“8”,
“bill_to_city”=>””,
“credit_card_company_id”=>“1”,
“phone”=>“512-222-3333”,
“fax”=>“”,
“bill_to_last_name”=>“”,
“bill_to_street”=>“”,
“ship_to_first_name”=>“Dave”,
“ship_to_state”=>“CO”,
“login”=>“bigpharma”,
“password”=>“password”,
“bill_to_state”=>“”,
“ship_to_company”=>“Dave Pharm”,
“email”=>“[email protected]”,
“bill_to_first_name”=>“”,
“bill_to_zip”=>“”},
“commit”=>“Create”}
On Sep 8, 8:19 am, Frederick C. [email protected]