Skip to content

Instantly share code, notes, and snippets.

@alksl
Created August 5, 2016 17:40
Show Gist options
  • Save alksl/04f585d2e98e57df15e613143aeb1321 to your computer and use it in GitHub Desktop.
Save alksl/04f585d2e98e57df15e613143aeb1321 to your computer and use it in GitHub Desktop.
require "rails/all"
require "rails_admin"
class ApplicationController < ActionController::Base
end
class MyModel < ActiveRecord::Base
end
class MyApp < Rails::Application
routes.append do
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
end
# Enable cache classes. Production style.
config.cache_classes = true
config.eager_load = true
# uncomment below to display errors
config.consider_all_requests_local = true
# We need a secret token for session, cookies, etc.
config.secret_token = "49837489qkuweoiuoqwehisuakshdjksadh"
end
RailsAdmin.config do |config|
config.included_models = [
"MyModel"
]
### More at https://github.com/sferik/rails_admin/wiki/Base-configuration
config.actions do
dashboard # mandatory
index # mandatory
new
export
bulk_delete
show
edit
delete
show_in_app
end
end
# Initialize the app (originally in config/environment.rb)
MyApp.initialize!
# Print the stack for fun!
puts ">> Starting Rails lightweight stack"
Rails.configuration.middleware.each do |middleware|
puts "use #{middleware.inspect}"
end
puts "run #{Rails.application.class.name}.routes"
# Run it (originally in config.ru)
run MyApp
development:
adapter: "postgresql"
host: "localhost"
username:
database:
port: 5432
source "https://rubygems.org"
gem "rails", "~> 4.2"
gem "rails_admin"
gem "pg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment