Displaying 1 result from an estimated 1 matches for "imagemodel".
Did you mean:
imagemod
2013 Sep 18
2
Accessing model attributes in ActiveSupport::Concern module
I have some models which share the same functionality just on other paths.
So I decided to put these methods in a module and set the path in the
model. My problem is that I''m not able to access the attribute in my module.
my model:
class Job < ActiveRecord::Base
include ImageModel
image_dir = "jobs"end
my module:
module ImageModel
extend ActiveSupport::Concern
def delete_image
unless pic_link == "" || pic_link == nil
begin
if File.delete(Rails.root.join("public", "images", image_dir, pic_link))...