ActiveRecord::Base#save returns false on validation errors.  It's
ActiveRecord::Base#save! that throws an error.  Try it with the
exclamation point.

-Andrew

On Dec 22, 2007 4:15 PM, Maged Makled <[EMAIL PROTECTED]> wrote:
> John W. Long wrote:
> > On Dec 22, 2007, at 2:08 PM, Maged Makled wrote:
> >> "contact"=>{"address1"=>"", "city"=>"", "work_phone"=>"",
> >> "license_state"=>"", "address2"=>"", "zip"=>"",
> >> "birth_date(1i)"=>"2007", "birth_date(2i)"=>"12",
> >> "birth_date(3i)"=>"22", "country"=>"USA", "cell_phone"=>"",
> >> "marital_status"=>"Single", "home_phone"=>"", "middle_initial"=>"E",
> >> "first_name"=>"", "last_name"=>"Makled", "social_number"=>"",
> >> "email"=>"", "driver_license"=>"", "state"=>""}, "controller"=>"auto"}
> >
> >
> > What does the code look like in your controller for saving the model?
> >
> > Can you try this with script/console and see if you get an error:
> >
> >  >> c = Contact.new
> >  >> c.save!
> >
> > --
> > John Long
> > http://wiseheartdesign.com
>
> When I tried with script/console here is what I got
> ****
> Loading development environment.
> >> c = Contact.new
> => #<Contact:0xb79d4a74 @attributes={"city"=>nil, "address1"=>nil,
> "work_phone"=>nil, "license_state"=>nil, "zip"=>nil, "address2"=>nil,
> "country"=>nil, "cell_phone"=>nil, "marital_status"=>nil,
> "birth_date"=>nil, "home_phone"=>nil, "middle_initial"=>nil,
> "first_name"=>nil, "social_number"=>nil, "last_name"=>nil, "email"=>nil,
> "driver_license"=>nil, "state"=>nil}, @new_record=true>
> >> c.save
> => false
> ******
>
> and that's what my action looks like
> **
> def myAction
>      radiant_render  :layout=> "/sub/"
>      if session[:contact].nil?
>        contact=Contact.new(params[:contact])
>
>         session[:contact]=contact
>
>         contact.save
>       end
>   end
> **
> --
> Posted via http://www.ruby-forum.com/.
>
> _______________________________________________
> Radiant mailing list
> Post:   [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to