Commit 6c8e648f authored by KitaitiMakoto's avatar KitaitiMakoto

Add database settings

parent ddb4cf40
......@@ -32,7 +32,7 @@ gem 'padrino', '0.11.2'
# gem 'padrino-' + g, '0.11.2'
# end
gem 'activerecord'
gem 'activerecord', :require => 'active_record'
gem 'pg'
gem 'padrino-sprockets', :require => 'padrino/sprockets'
......
require 'bundler/setup'
require 'padrino-core/cli/rake'
PadrinoTasks.use(:database)
PadrinoTasks.use(:activerecord)
PadrinoTasks.init
module Bibid
class App < Padrino::Application
use ActiveRecord::ConnectionAdapters::ConnectionManagement
register LessInitializer
register Padrino::Rendering
register Padrino::Mailer
......
##
# You can use other adapters like:
#
# ActiveRecord::Base.configurations[:development] = {
# :adapter => 'mysql2',
# :encoding => 'utf8',
# :reconnect => true,
# :database => 'your_database',
# :pool => 5,
# :username => 'root',
# :password => '',
# :host => 'localhost',
# :socket => '/tmp/mysql.sock'
# }
#
ActiveRecord::Base.configurations[:development] = {
:adapter => 'sqlite3',
:database => Padrino.root('db', 'twintails_development.db')
}
ActiveRecord::Base.configurations[:production] = {
:adapter => 'sqlite3',
:database => Padrino.root('db', 'twintails_production.db')
}
ActiveRecord::Base.configurations[:test] = {
:adapter => 'sqlite3',
:database => Padrino.root('db', 'twintails_test.db')
}
# Setup our logger
ActiveRecord::Base.logger = logger
# Raise exception on mass assignment protection for Active Record models.
ActiveRecord::Base.mass_assignment_sanitizer = :strict
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL).
ActiveRecord::Base.auto_explain_threshold_in_seconds = 0.5
# Include Active Record class name as root for JSON serialized output.
ActiveRecord::Base.include_root_in_json = false
# Store the full class name (including module namespace) in STI type column.
ActiveRecord::Base.store_full_sti_class = true
# Use ISO 8601 format for JSON serialized times and dates.
ActiveSupport.use_standard_json_time_format = true
# Don't escape HTML entities in JSON, leave that for the #json_escape helper
# if you're including raw JSON in an HTML page.
ActiveSupport.escape_html_entities_in_json = false
# Now we can establish connection with our db.
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Padrino.env])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment