Module: Puzzlize::ModelAdditions

Defined in:
lib/puzzlize/model_additions.rb

Instance Method Summary collapse

Instance Method Details

#get_puzzlize_attribute_nameObject



13
14
15
# File 'lib/puzzlize/model_additions.rb', line 13

def get_puzzlize_attribute_name
  @@puzzle_attribute_name
end

#puzzlize(attribute) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/puzzlize/model_additions.rb', line 4

def puzzlize(attribute)
  include Puzzlize::ModelInstanceMethods
  @@puzzle_attribute_name = attribute
  
  # one of the main reason why this doesn't run off of after create is because paperclip callback hook is after_save.
  # since I use paper's medium image, we need to run after save.
  # Because I did not want to tightly integrate with paperclip, I did not use their callback hooks.
  after_save :make_puzzle
  
  def get_puzzlize_attribute_name
    @@puzzle_attribute_name
  end
end