« Return to Thread: How to validate with validates_associated

How to validate with validates_associated

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View in Thread


Hi , i am facing strange problem i want to validate two models through
validates_associated,


class Cpanel::Banner < ActiveRecord::Base

  has_one :bannerimage
  validates_associated :bannerimage
  validates_presence_of :title
  validates_uniqueness_of :title
end


class Cpanel::Bannerimage < ActiveRecord::Base

  belongs_to :banner

  has_attachment    :content_type => :image,
         :storage => :file_system,
         :max_size => 10.megabytes,
         :min_size=>250.bytes,
         :resize_to => '320x200>',
         :processor => 'MiniMagick'

  validates_as_attachment
end

Here are two models , i am not getting only banner model validation but
not for bannerimage model .

Thanks .
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: How to validate with validates_associated