Pål Bergström wrote:
[...]
>   def create
>     @customer = Customer.new
>     if @customer.save
>       flash[:notice] = "Nytt konto skapat"
>       redirect_to :controller => 'basket'
>     end
> 
>   end
> 
> And this in model
> 
> validates_presence_of :first_name, :email
> 
> I can't get it right. I now get "Missing template customer/create.erb in 
> view path app/views" when trying to save without :first_name

Of course.  Your controller code is incorrect.  Note that, in the create 
action, the redirect is only called if @customer.save is true.  If 
validations fail, @customer.save is false, so Rails will try to render 
the view of the same name as the action ( create.html.erb ).  That 
doesn't exist, so you get an error.

I highly recommend using make_resourceful for your controllers.  It will 
make problems like this easier to avoid.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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