rails_db_localize 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +202 -0
- data/README.md +100 -0
- data/Rakefile +30 -0
- data/app/models/rails_db_localize/translation.rb +33 -0
- data/lib/ext/active_record_ext.rb +52 -0
- data/lib/ext/controller_ext.rb +19 -0
- data/lib/ext/migration_ext.rb +21 -0
- data/lib/rails_db_localize.rb +37 -0
- data/lib/rails_db_localize/translation_cache.rb +79 -0
- data/lib/rails_db_localize/version.rb +3 -0
- data/lib/tasks/rails_db_localize_tasks.rake +11 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/translatables.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/translatables.css +4 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/translatables_controller.rb +16 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/translatables_helper.rb +2 -0
- data/test/dummy/app/models/translatable.rb +3 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/translatables/index.html.erb +36 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +59 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20150907053532_create_translation_table.rb +5 -0
- data/test/dummy/db/migrate/20150907053908_create_translatable.rb +7 -0
- data/test/dummy/db/schema.rb +40 -0
- data/test/dummy/lib/tasks/populate.rake +11 -0
- data/test/dummy/log/development.log +8194 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/translatables_controller_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/3O2pqsT3ybnPUm6Gi7ErjmLeCBRRUWz4fMCvw-ibCB0.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/6qyNdZnWUudLJAOThY51h8UbkuubQ6d87qQokqr9_Io.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/9yOpc3M6o_Vd_0RjCLTe8PJNtWsWGrV4zdvCJgbMtvw.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ANeC_6Mk_I5aOnvx2d-aSzot3B_oq6NBEI2K_mJEnWM.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/BAArHgUaRCG_NHra3C0s9BRNUfg8e8yJC8Tw0wOKH-A.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/B_ZbUByps36PvVRYHSdlhwdAtP5-Zf3zVtDzL-IQNrQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/Cg8aXWizze0m2o4NT5ZriA69UfhbMK2hDD1D0oPK1JI.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DpdBg7WBC-mtsYWWSF3TjYyBBi-Evpi_ana2Hh_30LM.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ELlZNzycCi1-_hT_LCUVm1uUF65_XGNtAbDizvvphuA.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/EzYy4pCO7n17PL8udZ40Mjw8k09nEOwcWk4Oi-a_Hwg.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/NnJakuOJenyIjIygEryzdLDMdyyxVbseqRcdbkwnoAI.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/O4S1k7_Y87AttftaL1s29JQtwbK4syBxZMLzIVuu1vk.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/P3uTHiFsLRdy5tNIFjY3okQd6odvdpdGk6oogoFhoGk.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ZffU_0SbArG9GYeAowBJuJgaF1hVGbMNGeDIj9bqa9A.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/c8KYVj1rHA3NliflfWZWsyCpCQAFkHuDTGW0GGTL0Bo.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/iN2MkusZ4QURJ8-cxj-e7yLM4a1aqMS4VNwG63KkVZY.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/lCUSCqZNMlgdamWEpHVlaxIHvpPKRbmiI3DgkCQqQRQ.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/lZwz80GEq6cMAemaJYqRQdQbxAb92jM-0r0zq11lMxI.cache +0 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/vvbyKzG93brAbyVrZ7Q2gGUXUgcsVmB6eDpz25kvPFg.cache +1 -0
- data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/znAAVScTWs7VUkicijSLxlPcvxUCnkiPoFshMXcE458.cache +1 -0
- data/test/dummy/tmp/pids/server.pid +1 -0
- data/test/rails_db_localize_test.rb +7 -0
- data/test/test_helper.rb +19 -0
- metadata +274 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
class ActiveRecord::Migration
|
2
|
+
def create_rails_db_localize_translations
|
3
|
+
self.create_table :rails_db_localize_translations do |t|
|
4
|
+
t.string :resource_type, index: true
|
5
|
+
t.integer :resource_id, index: true
|
6
|
+
|
7
|
+
t.string :field, index: true
|
8
|
+
t.string :lang, index: true
|
9
|
+
t.integer :compound_key, index: true
|
10
|
+
|
11
|
+
t.text :content
|
12
|
+
t.timestamp
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :rails_db_localize_translations, [:resource_id, :resource_type], name: "index_rdblt_it"
|
16
|
+
add_index :rails_db_localize_translations, [:resource_id, :resource_type, :field], name: "index_rdblt_itf"
|
17
|
+
add_index :rails_db_localize_translations, [:resource_id, :resource_type, :field, :lang], name: "index_rdblt_itfl"
|
18
|
+
add_index :rails_db_localize_translations, [:compound_key, :field], name: "index_rdblt_cf"
|
19
|
+
add_index :rails_db_localize_translations, [:compound_key, :field, :lang], name: "index_rdblt_cfl"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module RailsDbLocalize
|
2
|
+
class << self
|
3
|
+
@schema = {}
|
4
|
+
|
5
|
+
# This is the schematics of fields
|
6
|
+
# Useful for rake tasks after, to know:
|
7
|
+
# - Which rows are not used anymore (because the field name has changed for example)
|
8
|
+
# - Which models are not yet translated
|
9
|
+
attr_reader :schema
|
10
|
+
|
11
|
+
def add_to_schema model, field
|
12
|
+
@schema ||= {}
|
13
|
+
@schema[model.to_s] ||= []
|
14
|
+
@schema[model.to_s] << field
|
15
|
+
end
|
16
|
+
|
17
|
+
def load!
|
18
|
+
%w(app/models).each do |dir|
|
19
|
+
path = File.join(File.expand_path('../..', __FILE__), dir )
|
20
|
+
$LOAD_PATH << path
|
21
|
+
ActiveSupport::Dependencies.autoload_paths << path
|
22
|
+
ActiveSupport::Dependencies.autoload_once_paths.delete(path)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def __rdbl_require(*args)
|
29
|
+
args.each do |path|
|
30
|
+
require File.join(File.expand_path("..", __FILE__), path)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
__rdbl_require 'rails_db_localize/translation_cache'
|
35
|
+
__rdbl_require 'ext/active_record_ext', 'ext/controller_ext', 'ext/migration_ext'
|
36
|
+
|
37
|
+
RailsDbLocalize::load!
|
@@ -0,0 +1,79 @@
|
|
1
|
+
class RailsDbLocalize::TranslationCache
|
2
|
+
class << self
|
3
|
+
def reinit
|
4
|
+
@instance = nil
|
5
|
+
end
|
6
|
+
|
7
|
+
def instance
|
8
|
+
@instance ||= self.new
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
def initialize
|
14
|
+
@cache = { :data => {}, :cks => {} }
|
15
|
+
end
|
16
|
+
|
17
|
+
def encache plucked
|
18
|
+
plucked.each do |rt_ri_f_l_c|
|
19
|
+
rt,ri,f, l,c = rt_ri_f_l_c #ressource_type, ressource_id, field, lang and content
|
20
|
+
@cache[:data][rt] ||= {}
|
21
|
+
@cache[:data][rt][ri] ||= {}
|
22
|
+
@cache[:data][rt][ri][l] ||= {}
|
23
|
+
@cache[:data][rt][ri][l][f] = c
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def is_cached *cks
|
28
|
+
cks.each{ |ck| @cache[:cks][ck] ||= true }
|
29
|
+
end
|
30
|
+
|
31
|
+
public
|
32
|
+
# For debug purpose only
|
33
|
+
attr_reader :cache
|
34
|
+
|
35
|
+
def prefetch_collections *collections
|
36
|
+
# empty string is used here to be sure there's at least one element
|
37
|
+
# for IN clause in SQL (otherwise it will fail miserabily)
|
38
|
+
in_clause = collections.inject([""]) do |arr, collection|
|
39
|
+
klass = if collection.respond_to?(:klass)
|
40
|
+
collection.klass #is a ActiveRecord::Relation
|
41
|
+
else
|
42
|
+
# Tricky part. sometimes using "all" the collection is already
|
43
|
+
# fetched. And there's not really anything to do to get the scope again. except mapping of the primary
|
44
|
+
# key but seems tricky, so I prefer raise an error.
|
45
|
+
if collection.is_a?(Array)
|
46
|
+
raise
|
47
|
+
"You're trying to get translations from a collection which is already fetched (SQL request already sent). " +
|
48
|
+
"This is happening when you are using map/each/all on the request. Please use the translation cache fetching before the request is sent."
|
49
|
+
else
|
50
|
+
collection # This is the model
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
arr + collection.pluck(klass.primary_key).map do |x|
|
55
|
+
RailsDbLocalize::Translation.generate_ck(klass, x)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
is_cached(*in_clause)
|
60
|
+
encache RailsDbLocalize::Translation.where("compound_key IN (?)", in_clause).pluck(:resource_type, :resource_id, :field, :lang, :content)
|
61
|
+
end
|
62
|
+
|
63
|
+
def get_translation_for model_class, model_id, field, lang, default
|
64
|
+
ck = RailsDbLocalize::Translation.generate_ck(model_class, model_id)
|
65
|
+
|
66
|
+
if @cache[:cks][ck]
|
67
|
+
#Prefetch was done. Check if there's a value
|
68
|
+
@cache[:data][model_class.to_s].try(:[], model_id).try(:[], lang.to_s).try(:[], field.to_s) || default
|
69
|
+
else
|
70
|
+
#Do the query if no prefetch was done
|
71
|
+
RailsDbLocalize::Translation.where(
|
72
|
+
resource_type: model_class.to_s, resource_id: model_id, field: field, lang: lang
|
73
|
+
).select(:content).first.try(:content) || default
|
74
|
+
# BTW We don't cache it now since a cache is done into ActiveRecord core...
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :rails_db_localize do
|
3
|
+
# # Task goes here
|
4
|
+
# end
|
5
|
+
|
6
|
+
#namespace :rails_db_localize do
|
7
|
+
# desc "Remove the orphans in the translations"
|
8
|
+
# task :delete_orphans => :environment do
|
9
|
+
# raise "TODO"
|
10
|
+
# end
|
11
|
+
#end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class TranslatablesController < ApplicationController
|
2
|
+
def index
|
3
|
+
@translatables = Translatable.all
|
4
|
+
preload_translations_for(@translatables)
|
5
|
+
end
|
6
|
+
|
7
|
+
def set_tr
|
8
|
+
require 'faker'
|
9
|
+
|
10
|
+
@translatable = Translatable.find(params[:id])
|
11
|
+
@translatable.name_translated = Faker::Lorem.paragraph, params[:lang]
|
12
|
+
@translatable.save!
|
13
|
+
|
14
|
+
redirect_to "/"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div>
|
2
|
+
<h1>Test Translatable</h1>
|
3
|
+
<h2>Schema:</h2>
|
4
|
+
<pre>
|
5
|
+
<%= RailsDbLocalize::schema.inspect %>
|
6
|
+
</pre>
|
7
|
+
<h2>TR Table:</h2>
|
8
|
+
<pre><%= RailsDbLocalize::Translation.all.pluck(:id, :compound_key, :field, :lang, :content).map{|x| x.inspect}.join("\n") %></pre>
|
9
|
+
<h2>Cache info:</h2>
|
10
|
+
<pre><%= RailsDbLocalize::TranslationCache.instance.cache %></pre>
|
11
|
+
<h2>Table info:</h2>
|
12
|
+
<table>
|
13
|
+
<thead>
|
14
|
+
<th>ID</th>
|
15
|
+
<th>Name</th>
|
16
|
+
<th>TR EN</th>
|
17
|
+
<th>TR ES</th>
|
18
|
+
<th>TR FR</th>
|
19
|
+
<th>Actions</th>
|
20
|
+
</thead>
|
21
|
+
<% @translatables.each do |t| %>
|
22
|
+
<tr>
|
23
|
+
<td><%= t.id %></td>
|
24
|
+
<td><%= t.name %></td>
|
25
|
+
<td><%= t.name_translated %></td>
|
26
|
+
<td><%= t.name_translated(:es) %></td>
|
27
|
+
<td><%= t.name_translated(:fr) %></td>
|
28
|
+
<td>
|
29
|
+
<a href="/set_tr/<%=t.id%>/en">GEN EN</a>
|
30
|
+
<a href="/set_tr/<%=t.id%>/es">GEN ES</a>
|
31
|
+
<a href="/set_tr/<%=t.id%>/fr">GEN FR</a>
|
32
|
+
</td>
|
33
|
+
</tr>
|
34
|
+
<% end %>
|
35
|
+
</table>
|
36
|
+
</div>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "rails_db_localize"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|