Sha256: 3111a013110153f4400fdf008af1de7172f4cedb60d4d3c8b5792045f028b655
Contents?: true
Size: 1.39 KB
Versions: 149
Compression:
Stored size: 1.39 KB
Contents
module Flydata module Heroku module ConfigurationMethods extend ActiveSupport::Concern included do if respond_to?(:class_attribute) class_attribute :_flydata_table_name class_attribute :_flydata_attributes else class_inheritable_accessor :_flydata_table_name class_inheritable_accessor :_flydata_attributes end self._flydata_table_name = nil self._flydata_attributes = nil end module ClassMethods # @example # class User < ActiveRecord::Base # flydata_attr :id, :name # end def flydata_attr(*attributes) raise "flydata_attr attributes cannot be blank" if attributes.empty? self._flydata_attributes = attributes.map(&:to_sym) end # @example # class User < ActiveRecord::Base # flydata_table :other_table # end def flydata_table(table_name) self._flydata_table_name = table_name end # @return [String] def flydata_table_name self._flydata_table_name ||= if self.ancestors.include?(ActiveRecord::Base) self.table_name else self.name.tableize end end end end end end
Version data entries
149 entries across 149 versions & 1 rubygems