module AASM::Generators::OrmHelpers
Public Instance Methods
model_contents()
click to toggle source
# File lib/generators/aasm/orm_helpers.rb, line 5 def model_contents if column_name == 'aasm_state' <<RUBY include AASM aasm do end RUBY else <<RUBY include AASM aasm :column => '#{column_name}' do end RUBY end end
Private Instance Methods
column_exists?()
click to toggle source
# File lib/generators/aasm/orm_helpers.rb, line 25 def column_exists? table_name.singularize.humanize.constantize.column_names.include?(column_name.to_s) rescue NameError false end
model_exists?()
click to toggle source
# File lib/generators/aasm/orm_helpers.rb, line 31 def model_exists? File.exist?(File.join(destination_root, model_path)) end
model_path()
click to toggle source
# File lib/generators/aasm/orm_helpers.rb, line 35 def model_path @model_path ||= File.join("app", "models", "#{file_path}.rb") end