class Rails::Generators::JbuilderGenerator
:nodoc:
def attributes_list(attributes = attributes_names)
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
def attributes_names
def attributes_names [:id] + super end
def copy_view_files
def copy_view_files %w(index show).each do |view| filename = filename_with_extensions(view) template filename, File.join('app/views', controller_file_path, filename) end template filename_with_extensions('partial'), File.join('app/views', controller_file_path, filename_with_extensions("_#{singular_table_name}")) end
def create_root_folder
def create_root_folder path = File.join('app/views', controller_file_path) empty_directory path unless File.directory?(path) end
def filename_with_extensions(name)
def filename_with_extensions(name) [name, :json, :jbuilder] * '.' end
def full_attributes_list
def full_attributes_list if options[:timestamps] attributes_list(attributes_names + %w(created_at updated_at)) else attributes_list(attributes_names) end end
def partial_path_name
def partial_path_name [controller_file_path, singular_table_name].join("/") end
def virtual_attributes
def virtual_attributes attributes.select {|name| name.respond_to?(:virtual?) && name.virtual? } end