class Rails::Generators::KamigoGenerator
Public Instance Methods
copy_view_files()
click to toggle source
# File lib/generators/rails/kamigo/kamigo_generator.rb, line 19 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/kamigo_generator.rb, line 14 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/kamigo_generator.rb, line 48 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/kamigo_generator.rb, line 27 def attributes_names [:id] + super end
filenames()
click to toggle source
# File lib/generators/rails/kamigo/kamigo_generator.rb, line 31 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/kamigo_generator.rb, line 40 def full_attributes_list if options[:timestamps] attributes_list(attributes_names + %w(created_at updated_at)) else attributes_list(attributes_names) end end