Forum: Ruby on Rails Problem during validation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1abc83b87c6f1d430e59c57a7e9d0bae?d=identicon&s=25 Werner Laude (Guest)
on 2008-12-05 16:56
(Received via mailing list)
Hi..I need some advice:

A formular which includes 3 partials
The partial will be chosen by userinput stored in a session

Controller:
def new
   @booking = Booking.new
   @booking_partial = partial_choice(session[:pre][:fahrt]) # 1,2 or 3

this works fine, but if the validation fails the partial will not be
shown again..!

Looks like the 'partial_choice' is not getting information then. I
dont see the point where to feed that info in again.

Thanks for your help
Werner
D188e591eac11021329b8821a5f954c7?d=identicon&s=25 Ar Chron (railsdog)
on 2008-12-05 19:07
When your save fails, are you re-seeding the @booking_partial value?

def create
  if @booking.save
    # the happy path
  else
    @booking_partial = blah blah blah
    render :action => 'new'
  end
end
1abc83b87c6f1d430e59c57a7e9d0bae?d=identicon&s=25 Werner Laude (Guest)
on 2008-12-05 22:34
(Received via mailing list)
Thanks..
This topic is locked and can not be replied to.