Class: Property::Image
- Inherits:
-
Object
- Object
- Property::Image
- Defined in:
- lib/ecrire/app/models/property/image.rb
Instance Attribute Summary collapse
-
#post ⇒ Object
Returns the value of attribute post.
Instance Method Summary collapse
Instance Attribute Details
#post ⇒ Object
Returns the value of attribute post.
3 4 5 |
# File 'lib/ecrire/app/models/property/image.rb', line 3 def post @post end |
Instance Method Details
#create(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ecrire/app/models/property/image.rb', line 9 def create(params) unless post.header.nil? post.header.destroy end img = post.images.build img.file = params[:admin_image][:file] img.save post.header = img post.save end |
#destroy(value) ⇒ Object
TODO:
-
Remove id in post properties
22 23 24 25 26 |
# File 'lib/ecrire/app/models/property/image.rb', line 22 def destroy(value) return if post.header.nil? img = post.header img.destroy end |
#name ⇒ Object
5 6 7 |
# File 'lib/ecrire/app/models/property/image.rb', line 5 def name "image" end |