Hi all,

not specifically a Hobo thing, but I can't find a resolution on other 
forums...
I'm trying to validate that a field is not null, if a specific category has 
been picked from the has_many association.
Model speaks for itself (this is simplified, not all my code)...

  fields do
   food_range :text
   timestamps
  end

  has_many :categories, :through => :category_assignments, :accessible => 
true
  has_many :category_assignments, :dependent => :destroy

  validates :food_style, :presence => true, :if => 
*"self.categories.include?(:id 
=> 1)"*

All I'm trying to do is check if :id => 1 is included in the list of 
categories.  This always returns false at the moment.

Any ideas?

Cheers, Anthony.


-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/hobousers/-/MnwmPW_gHD8J.
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/hobousers?hl=en.

Reply via email to