WIP
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
886431b43d
commit
614ff79ba1
14
app/models/concerns/imageable.rb
Normal file
14
app/models/concerns/imageable.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# can [:update, :destroy ], Image, :imageable_id => user.id, :imageable_type => 'User'
|
||||
# and add a feature like forbidden/without_role_images_spec.rb to test it
|
||||
module Imageable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_one :image, as: :imageable, dependent: :destroy
|
||||
accepts_nested_attributes_for :image, allow_destroy: true
|
||||
|
||||
def image_url(style)
|
||||
image.attachment.url(style) if image && image.attachment.exists?
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user