There are hooks for after create and after save (and update,
destroy...etc)
just implement a method that is called after_create and put your
validation there, you can revert chanegs if your size is incorrect.
There is another way. validations in models allow the :on key like
validate :correct_size :on => :create
def correct-size
errors.add...
end
i might be completely on another topic though :-)
On Jul 2, 9:02 pm, Xdmx Xdmx
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi guys, i''m using attachment_fu for uploading images, but
i''ve to check
> that the width and the height are at least 200px, how can i do this?
> i''ve tried to do a validate errors.add(:width,
'''') if
> self.parent_id.nil? and self.width < 200, but this doesn''t
work, both
> the width and height are nil, so i think that them are set after the
> validation
> thanks
> --
> Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---