2014-02-27 04:13:53 -07:00
|
|
|
class Contract < ActiveRecord::Base
|
|
|
|
belongs_to :user
|
2014-04-10 20:10:04 -07:00
|
|
|
belongs_to :created_by, :foreign_key => "created_by_id", :class_name => "User"
|
2014-04-10 19:45:29 -07:00
|
|
|
attr_accessible :user_id, :first_name, :last_name, :cosigner,
|
|
|
|
:signed_at, :document, :document_file_name, :document_content_type,
|
|
|
|
:document_file_size, :document_updated_at
|
|
|
|
# :created_by not accessible for security purposes
|
2014-02-27 04:13:53 -07:00
|
|
|
|
2014-03-02 19:39:04 -07:00
|
|
|
validates_presence_of :first_name, :signed_at #, :last_name
|
2014-02-27 04:13:53 -07:00
|
|
|
|
2014-04-12 15:05:57 -07:00
|
|
|
has_attached_file :document,
|
|
|
|
{ :styles =>
|
|
|
|
{
|
|
|
|
:medium => "300x300>",
|
|
|
|
:large => "900x900>"
|
|
|
|
},
|
|
|
|
:storage => :s3,
|
|
|
|
:s3_protocol => :https,
|
|
|
|
:s3_credentials => { :access_key_id => ENV['S3_KEY'],
|
|
|
|
:secret_access_key => ENV['S3_SECRET'] },
|
|
|
|
:path => ":attachment/:id/:style.:extension",
|
|
|
|
:bucket => ENV['S3_BUCKET']
|
|
|
|
}
|
2014-02-27 04:13:53 -07:00
|
|
|
end
|