class Effective::Generators::ModelGenerator
Public Instance Methods
create_model()
click to toggle source
# File lib/generators/effective/model_generator.rb, line 22 def create_model template 'models/model.rb', resource.model_file end
invoke_model()
click to toggle source
# File lib/generators/effective/model_generator.rb, line 18 def invoke_model say_status :invoke, :model, :white end
Protected Instance Methods
max_attribute_name_length()
click to toggle source
# File lib/generators/effective/model_generator.rb, line 36 def max_attribute_name_length @max_attribute_name_length ||= (invoked_attributes.keys.map { |att| att.to_s.length }.max || 0) end
parent_class_name()
click to toggle source
# File lib/generators/effective/model_generator.rb, line 28 def parent_class_name options[:parent] || (Rails::VERSION::MAJOR > 4 ? 'ApplicationRecord' : 'ActiveRecord::Base') end
to_s_attribute()
click to toggle source
# File lib/generators/effective/model_generator.rb, line 32 def to_s_attribute [:display_name, :name, :title, :subject].find { |att| invoked_attributes.key?(att) } end