Class: Administrate::Generators::RoutesGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/administrate/routes/routes_generator.rb

Instance Method Summary collapse

Instance Method Details

#insert_dashboard_routesObject



11
12
13
14
15
# File 'lib/generators/administrate/routes/routes_generator.rb', line 11

def insert_dashboard_routes
  if should_route_dashboard?
    route(dashboard_routes)
  end
end

#warn_about_invalid_modelsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/administrate/routes/routes_generator.rb', line 17

def warn_about_invalid_models
  namespaced_models.each do |invalid_model|
    puts "WARNING: Unable to generate a dashboard for #{invalid_model}."
    puts "         Administrate does not yet support namespaced models."
  end

  models_without_tables.each do |invalid_model|
    puts "WARNING: Unable to generate a dashboard for #{invalid_model}."
    puts "         It is not connected to a database table."
    puts "         Make sure your database migrations are up to date."
  end

  unnamed_constants.each do |invalid_model|
    puts "NOTICE: Skipping dynamically generated model #{invalid_model}."
  end
end