Forum: Ruby on Rails 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.
(Guest)
on 2007-02-21 01:35
(Received via mailing list)
I'm very happy so far with the Rails framework (at least compared to
J2EE). But I have some trouble
whith the valid?() method of ActiveRecord modell objects:
In the following code-snippet (behind a post-action the valid-method
sometimes is only the first-time
triggert. Pressing the back-button in the browser an submitting again
ignores the valid-action.

    @user = User.new(params[:user])
    @country = Country.new(params[:country])
    @address = Address.new(params[:address])

    @industry_overview =
IndustrieOverview.new(params[:industrie_overview])
    if request.post?
      # validation of the input field (before any save action)
      @user.valid?()
      @address.valid?()
   ...User.save(@user, @address) rescue puts "Save failed!"
Has anybody an idea?
Regards from Germany
This topic is locked and can not be replied to.