Topic: Skip validation not working

For a rec sports league app, I have a Player model set up with some typical validation on signup:

  validates_length_of :login, :within => 3..40
  validates_length_of :password, :within => 5..40
  validates_presence_of :login, :email, :password, :password_confirmation, :salt
  validates_uniqueness_of :login, :email, :on => :create
  validates_confirmation_of :password

This works well during initial signup and when a player edits his/her profile. But I also have a page to register for each season, which doesn't include all the fields (namely password), because a player already will have logged in before getting to this page.

Problem is, by NOT sending the password attribute and trying to do a save, I get validation errors (password missing, not long enough, no confirmation, etc.) even when I try a @player.save(false) ... or @player.save_with_validation(false).

Here's the still-in-progress def, which still brings up validation errors:

  def register
    @player = Player.find(session[:player][:id])
    if request.post? 
      if @player.save(false)
        flash[:message] = "Registration successful"
        redirect_to :action => "pay"         
      else
        flash[:warning] = "Registration unsuccessful"
      end
    end
  end

I suppose I could include password and confirmation as hidden variables, but that's an ugly workaround that I'm sure is unnecessary.

Any clues?

Thanks.

Re: Skip validation not working

D'ohhhh! I'm an idiot.

It helps to have the form action point to the right page.

Nevermind.