Finishing contracts, changing from s3.yml to .env
This commit is contained in:
@@ -12,6 +12,7 @@ class Ability
|
||||
# By default, users can only see their own stuff
|
||||
can :read, Card, :user_id => user.id
|
||||
can :read, Certification
|
||||
can :read, Contract
|
||||
can :read_details, Mac
|
||||
can [:update], Mac, :user_id => nil
|
||||
can [:create,:update], Mac, :user_id => user.id
|
||||
@@ -54,7 +55,7 @@ class Ability
|
||||
can :manage, :all
|
||||
end
|
||||
|
||||
# Prevent all destruction for now
|
||||
# Prevent most destruction for now
|
||||
#cannot :destroy, User
|
||||
#cannot :destroy, Card
|
||||
cannot :destroy, Certification
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
class Contract < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
attr_accessible :user_id, :first_name, :last_name, :signed_at, :document_file_name, :document_content_type, :document_file_size, :document_updated_at
|
||||
attr_accessible :user_id, :first_name, :last_name, :signed_at, :document, :document_file_name, :document_content_type, :document_file_size, :document_updated_at
|
||||
|
||||
validates_presence_of :first_name, :last_name, :signed_at
|
||||
|
||||
has_attached_file :document, { :styles => { :medium => "300x300>"},
|
||||
:storage => :s3,
|
||||
:s3_credentials => Rails.root.join('config', 's3.yml'),
|
||||
:s3_credentials => { :access_key_id => ENV['S3_KEY'],
|
||||
:secret_access_key => ENV['S3_SECRET'] },
|
||||
:path => ":attachment/:id/:style.:extension",
|
||||
:bucket => 'Toolshare' } #TODO: move to local storage
|
||||
:bucket => ENV['S3_BUCKET'] }
|
||||
end
|
||||
|
||||
@@ -14,11 +14,12 @@ class Resource < ActiveRecord::Base
|
||||
:thumb => "100x100>",
|
||||
:tiny => "50x50>"},
|
||||
:storage => :s3,
|
||||
:s3_credentials => Rails.root.join('config', 's3.yml'),
|
||||
:s3_credentials => { :access_key_id => ENV['S3_KEY'],
|
||||
:secret_access_key => ENV['S3_SECRET'] },
|
||||
:path => ":attachment/:id/:style.:extension",
|
||||
:bucket => 'Toolshare' }
|
||||
:bucket => ENV['S3_BUCKET'] }
|
||||
|
||||
has_attached_file :picture, PICTURE_OPTIONS #TODO: move to local storage
|
||||
has_attached_file :picture, PICTURE_OPTIONS
|
||||
has_attached_file :picture2, PICTURE_OPTIONS
|
||||
has_attached_file :picture3, PICTURE_OPTIONS
|
||||
has_attached_file :picture4, PICTURE_OPTIONS
|
||||
|
||||
@@ -14,6 +14,7 @@ class User < ActiveRecord::Base
|
||||
has_many :cards
|
||||
has_many :user_certifications
|
||||
has_many :certifications, :through => :user_certifications
|
||||
has_many :contracts
|
||||
has_many :payments
|
||||
has_many :macs
|
||||
has_many :resources
|
||||
|
||||
Reference in New Issue
Block a user