On Jun 29, 2011, at 7:45 PM, hobo_hippy wrote:

> So it's pretty clear you can require a field like title below:
> 
> 
> fields do
>    timestamps
>    title :string, :required
>    event :string
>  end
> 
> but what if I wanted to require an attachment using paperclip-with-
> hobo?
> 
> I already have an photo attachment setup as below:
> 
> has_attached_file :photo, :default_url => "/images/blah.jpg"
> 
> 
> but I have no idea how to REQUIRE that a user uploads an image. Any
> ideas? possible solutions?

:required on a field is really just a shorthand for validates_presence_of (a 
standard AR validation). There are some attachment-specific validations in 
Paperclip, but they apparently aren't cool enough to mention in the README. 
Here's the rdoc:

http://rdoc.info/gems/paperclip/2.3.12/Paperclip/ClassMethods

--Matt Jones


-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
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