Ramy
Ramy

Reputation: 21261

Validation failure when there are no validations for the field in my model

UPDATE: I'm a dunce. the distribution class is subclassed and THOSE classes are validating the status field.

If it isn't obvious at this point that i'm a comoplete n00b to rails, it might not even be worth saying. I'm trying to persist some changes to a table in the DB from a form i've created. The problem is that when I hit the submit button, i get this:

Validation failed: Status is not included in the list

what i don't understand (aside from the whole error message - what list?) is that status is not validated in my model:

validates_presence_of :resume
validates_presence_of :matching_profile
validates_uniqueness_of :matching_profile_id, :scope => :owner_id
validates_numericality_of :price, :greater_than => 0, :allow_blank => true

nothing about status that I can see.

update:

all the associations in my model:

belongs_to :matching_profile, :counter_cache => true belongs_to :resume

update:

the problem seems to actually be in my controller:

def update_multiple
  @distributions = Distribution.find(params[:distribution_ids])
  @distributions.each do |distribution|
    distribution.update_attributes!(params[:distro].reject { |k,v| v.blank? }) #raising an exception
  end
  flash[:notice] = "Updated Distribution Workflow"
  redirect_to admin_distributions_workflows_path
end

Upvotes: 1

Views: 1031

Answers (1)

Ramy
Ramy

Reputation: 21261

the status field is being validated in a subclass.

Upvotes: 2

Related Questions