class TailorMade::DashboardGenerator
Public Instance Methods
create_resource_controller()
click to toggle source
# File lib/generators/tailor_made/dashboard/dashboard_generator.rb, line 19 def create_resource_controller destination = Rails.root.join( "app/controllers/#{namespace}/#{regular_file_path.pluralize}_controller.rb", ) template("controller.rb.erb", destination) end
create_resource_query()
click to toggle source
# File lib/generators/tailor_made/dashboard/dashboard_generator.rb, line 9 def create_resource_query queries_dir = Rails.root.join("app/queries/#{namespace}") FileUtils.mkdir_p(queries_dir) unless File.directory?(queries_dir) destination = Rails.root.join( "app/queries/#{namespace}/#{regular_file_path}_query.rb", ) template("query.rb.erb", destination) end
create_resource_view()
click to toggle source
# File lib/generators/tailor_made/dashboard/dashboard_generator.rb, line 27 def create_resource_view destination = Rails.root.join( "app/views/#{namespace}/#{regular_file_path.pluralize}/index.html.erb", ) copy_file("index.html.erb", destination) end
Private Instance Methods
namespace()
click to toggle source
# File lib/generators/tailor_made/dashboard/dashboard_generator.rb, line 37 def namespace options['namespace'] end
regular_file_path()
click to toggle source
# File lib/generators/tailor_made/dashboard/dashboard_generator.rb, line 41 def regular_file_path (regular_class_path + [file_name]).map!(&:camelize).join("::").underscore end