Method: ActiveFacts::Generators::Rails::Models#model_body
- Defined in:
- lib/activefacts/generators/rails/models.rb
#model_body(table) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/activefacts/generators/rails/models.rb', line 192 def model_body table %Q{module #{table.rails_class_name} extend ActiveSupport::Concern included do} + (table.identifier_columns.length == 1 ? %Q{ self.primary_key = '#{table.identifier_columns[0].rails_name}' } : '' ) + ( to_associations(table) + from_associations(table) + column_constraints(table) ) * "\n" + %Q{ end end } end |