Skip to content

Instantly share code, notes, and snippets.

@abuiles
Created December 9, 2009 19:24
Show Gist options
  • Save abuiles/252712 to your computer and use it in GitHub Desktop.
Save abuiles/252712 to your computer and use it in GitHub Desktop.
class Novelty < ActiveRecord::Base
attr_accessible :body, :photo, :title
has_and_belongs_to_many :topics
has_attached_file :photo,
:styles => { :thumb=> "100x100#",:small => "150x150>" },
:url => "/uploads/images/:class/:attachment/:id/:style/:basename.:extension",
:path => ":rails_root/public/uploads/images/:class/:attachment/:id/:style/:basename.:extension"
validates_attachment_content_type :photo,:content_type => ['image/jpeg','image/gif' ] unless #Aqui necesito preguntar si hay imagen o no
validates_attachment_size :photo , :less_than => 3.megabytes unless #Aqui necesito preguntar si hay imagen o no
validates_presence_of :body , :title
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment