class Rails::Generators::CreateStateGenerator
Public Instance Methods
copy_view_files()
click to toggle source
# File lib/generators/rails/kamigo/state_generator.rb, line 18 def copy_view_files filenames.each do |filename| template filename, File.join('app/views', controller_file_path, filename) end end
create_root_folder()
click to toggle source
# File lib/generators/rails/kamigo/state_generator.rb, line 13 def create_root_folder path = File.join('app/views', controller_file_path) empty_directory path unless File.directory?(path) end
Protected Instance Methods
attributes_list(attributes = attributes_names)
click to toggle source
# File lib/generators/rails/kamigo/state_generator.rb, line 47 def attributes_list(attributes = attributes_names) if self.attributes.any? {|attr| attr.name == 'password' && attr.type == :digest} attributes = attributes.reject {|name| %w(password password_confirmation).include? name} end attributes.map { |a| ":#{a}"} * ', ' end
attributes_names()
click to toggle source
Calls superclass method
# File lib/generators/rails/kamigo/state_generator.rb, line 26 def attributes_names [:id] + super end
filenames()
click to toggle source
# File lib/generators/rails/kamigo/state_generator.rb, line 30 def filenames [ "index.line.erb", "show.line.erb", "edit.liff.erb", "new.liff.erb", ] end
full_attributes_list()
click to toggle source
# File lib/generators/rails/kamigo/state_generator.rb, line 39 def full_attributes_list if options[:timestamps] attributes_list(attributes_names + %w(created_at updated_at)) else attributes_list(attributes_names) end end