cards and section get proper belongs_to associations
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
require "mini_magick"
|
||||
require "mini_magick"
|
||||
|
||||
module Merged
|
||||
class Image < ActiveYaml::Base
|
||||
|
@ -103,5 +103,12 @@ module Merged
|
||||
Section.reload
|
||||
end
|
||||
|
||||
def self.transform
|
||||
Section.all.each do |card|
|
||||
card.image = card.image_old
|
||||
card.save
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -8,6 +8,8 @@ module Merged
|
||||
set_root_path Rails.root #ouside engines not necessary
|
||||
include ActiveHash::Associations
|
||||
|
||||
belongs_to :image , class_name: "Merged::Image"
|
||||
|
||||
fields :options , :updated_at , :updated_by
|
||||
|
||||
def has_option?(option)
|
||||
@ -61,7 +63,7 @@ module Merged
|
||||
template_style.fields.collect{|f| f.to_sym}
|
||||
end
|
||||
|
||||
def image
|
||||
def image_old
|
||||
Image.find_by_name(self.image_name)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user