Module: Flydata::Heroku::ConfigurationMethods::ClassMethods

Defined in:
lib/flydata/heroku/configuration_methods.rb

Instance Method Summary collapse

Instance Method Details

#flydata_attr(*attributes) ⇒ Object

Examples:

class User < ActiveRecord::Base
  flydata_attr :id, :name
end


23
24
25
26
# File 'lib/flydata/heroku/configuration_methods.rb', line 23

def flydata_attr(*attributes)
  raise "flydata_attr attributes cannot be blank" if attributes.empty?
  self._flydata_attributes = attributes.map(&:to_sym)
end

#flydata_table(table_name) ⇒ Object

Examples:

class User < ActiveRecord::Base
  flydata_table :other_table
end


32
33
34
# File 'lib/flydata/heroku/configuration_methods.rb', line 32

def flydata_table(table_name)
  self._flydata_table_name = table_name
end

#flydata_table_nameString

Returns:

  • (String)


37
38
39
40
41
42
43
# File 'lib/flydata/heroku/configuration_methods.rb', line 37

def flydata_table_name
  self._flydata_table_name ||= if self.ancestors.include?(ActiveRecord::Base)
                                 self.table_name
                               else
                                 self.name.tableize
                               end
end