ar_default_values 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +25 -48
- data/.rspec +2 -0
- data/.rubocop.yml +13 -0
- data/.travis.yml +6 -4
- data/Gemfile +1 -11
- data/Guardfile +32 -0
- data/Rakefile +9 -17
- data/ar_default_values.gemspec +23 -13
- data/lib/ar_default_values/railtie.rb +9 -0
- data/lib/ar_default_values/version.rb +1 -1
- data/lib/ar_default_values.rb +3 -6
- data/spec/ar_default_values_spec.rb +42 -49
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/book.rb +2 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +22 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +78 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20141010061040_create_books.rb +11 -0
- data/spec/dummy/db/schema.rb +25 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +17 -0
- data/spec/spec_helper.rb +84 -12
- metadata +257 -27
- data/spec/test.sqlite3 +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cf0954f72cbdb345ce93476ca29c5fd82268ddc
|
4
|
+
data.tar.gz: 527a4418a22a85e0950bb744c22771f0f1c4b2e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42d44a47af13abb6001f6a8f6d89e758b752e45052d42c7dcc73d01b98636466a353b9c77717c2f2baac561d866e811d992ed65211554025cb422db498195e4d
|
7
|
+
data.tar.gz: 9c98c48769645af886388cc014d1a96e4c571874bd9f09a84737b8a61b7ecb38b6e4c73748356291c0d145562a7651c6b2dd640e232eb6acbd29a126c4ec213c
|
data/.gitignore
CHANGED
@@ -1,51 +1,28 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
1
6
|
Gemfile.lock
|
2
|
-
|
3
|
-
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
4
9
|
coverage
|
5
|
-
|
6
|
-
|
7
|
-
# rdoc generated
|
8
|
-
rdoc
|
9
|
-
|
10
|
-
# yard generated
|
11
|
-
doc
|
12
|
-
.yardoc
|
13
|
-
|
14
|
-
# bundler
|
15
|
-
.bundle
|
16
|
-
|
17
|
-
# jeweler generated
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
18
12
|
pkg
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# For TextMate
|
36
|
-
#*.tmproj
|
37
|
-
#tmtags
|
38
|
-
|
39
|
-
# For emacs:
|
40
|
-
#*~
|
41
|
-
#\#*
|
42
|
-
#.\#*
|
43
|
-
|
44
|
-
# For vim:
|
45
|
-
#*.swp
|
46
|
-
|
47
|
-
# For redcar:
|
48
|
-
#.redcar
|
49
|
-
|
50
|
-
# For rubinius:
|
51
|
-
#*.rbc
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
log/*.log
|
24
|
+
spec/dummy/db/*.sqlite3
|
25
|
+
spec/dummy/db/*.sqlite3-journal
|
26
|
+
spec/dummy/log/*.log
|
27
|
+
spec/dummy/tmp/
|
28
|
+
spec/dummy/.sass-cache
|
data/.rspec
CHANGED
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
guard :bundler do
|
2
|
+
watch('Gemfile')
|
3
|
+
# Uncomment next line if your Gemfile contains the `gemspec' command.
|
4
|
+
# watch(/^.+\.gemspec/)
|
5
|
+
end
|
6
|
+
|
7
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
8
|
+
watch(%r{^spec/.+_spec\.rb$})
|
9
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
10
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
11
|
+
|
12
|
+
# Rails example
|
13
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
14
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
15
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
16
|
+
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
17
|
+
watch('config/routes.rb') { 'spec/routing' }
|
18
|
+
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
|
19
|
+
watch('spec/rails_helper.rb') { 'spec' }
|
20
|
+
|
21
|
+
# Capybara features specs
|
22
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
23
|
+
|
24
|
+
# Turnip features and steps
|
25
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
26
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
27
|
+
end
|
28
|
+
|
29
|
+
guard :rubocop, cli: '--auto-correct' do
|
30
|
+
watch(%r{.+\.rb$})
|
31
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
32
|
+
end
|
data/Rakefile
CHANGED
@@ -1,23 +1,15 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
2
6
|
|
3
7
|
require 'bundler/gem_tasks'
|
4
|
-
|
5
8
|
require 'rspec/core/rake_task'
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
spec.rcov = true
|
11
|
-
end
|
10
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
11
|
+
load 'rails/tasks/engine.rake'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
require 'rdoc/task'
|
16
|
-
Rake::RDocTask.new do |rdoc|
|
17
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
18
14
|
|
19
|
-
|
20
|
-
rdoc.title = "ar_default_values #{version}"
|
21
|
-
rdoc.rdoc_files.include('README*')
|
22
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
-
end
|
15
|
+
task default: :spec
|
data/ar_default_values.gemspec
CHANGED
@@ -4,22 +4,32 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'ar_default_values/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'ar_default_values'
|
8
8
|
spec.version = DefaultValues::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description =
|
12
|
-
spec.summary =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['masarakki']
|
10
|
+
spec.email = ['masaki@hisme.net']
|
11
|
+
spec.description = 'ActiveRecord with default values'
|
12
|
+
spec.summary = 'ActiveRecord with default values'
|
13
|
+
spec.homepage = 'https://github.com/masarakki/ar_default_values'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.files = `git ls-files`.split(
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_dependency 'rails', '>= 3.2'
|
23
|
+
spec.add_development_dependency 'sqlite3'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec-rails'
|
27
|
+
spec.add_development_dependency 'rspec-its'
|
28
|
+
spec.add_development_dependency 'pry'
|
29
|
+
spec.add_development_dependency 'pry-doc'
|
30
|
+
spec.add_development_dependency 'guard'
|
31
|
+
spec.add_development_dependency 'guard-rspec'
|
32
|
+
spec.add_development_dependency 'guard-bundler'
|
33
|
+
spec.add_development_dependency 'guard-rubocop'
|
34
|
+
spec.add_development_dependency 'rdoc'
|
25
35
|
end
|
data/lib/ar_default_values.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require '
|
3
|
-
require 'active_record'
|
1
|
+
require 'ar_default_values/version'
|
2
|
+
require 'ar_default_values/railtie' if defined?(Rails)
|
4
3
|
|
5
4
|
#
|
6
5
|
# = ActiveRecord::DefaultValue
|
@@ -44,7 +43,7 @@ module DefaultValues
|
|
44
43
|
def default_values(defaults = {}, &block)
|
45
44
|
define_method(:initialize_with_default_values) do |*attributes, &inner_block|
|
46
45
|
defaults = defaults.merge(block.call) if block_given?
|
47
|
-
defaults = Hash[defaults.each_pair.map{ |key, value| [key, value.
|
46
|
+
defaults = Hash[defaults.each_pair.map { |key, value| [key, value.is_a?(Proc) ? value.call : value] }]
|
48
47
|
|
49
48
|
initialize_without_default_values(*attributes, &inner_block)
|
50
49
|
|
@@ -57,5 +56,3 @@ module DefaultValues
|
|
57
56
|
end
|
58
57
|
end
|
59
58
|
end
|
60
|
-
|
61
|
-
ActiveRecord::Base.send(:include, DefaultValues)
|
@@ -1,89 +1,82 @@
|
|
1
|
-
require
|
1
|
+
require 'rails_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class Book1 < Book
|
4
4
|
attr_protected :edition if Rails.version.to_i < 4
|
5
5
|
|
6
|
-
default_values price: 0, edition: 1, released_at:
|
6
|
+
default_values price: 0, edition: 1, released_at: -> { Time.now }
|
7
7
|
end
|
8
8
|
|
9
|
-
class Book2 <
|
9
|
+
class Book2 < Book
|
10
10
|
self.table_name = :books
|
11
11
|
attr_protected :edition if Rails.version.to_i < 4
|
12
12
|
default_values price: 0, edition: 1 do
|
13
13
|
t = Time.now
|
14
|
-
{:
|
14
|
+
{ released_at: t }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
class Book3 <
|
18
|
+
class Book3 < Book
|
19
19
|
self.table_name = :books
|
20
20
|
attr_accessible :price if Rails.version.to_i < 4
|
21
21
|
default_values price: 0, edition: 1, released_at: -> { Time.now }
|
22
22
|
end
|
23
23
|
|
24
|
-
describe
|
24
|
+
describe DefaultValues do
|
25
25
|
let!(:now) { Time.at(Time.now.to_i) }
|
26
26
|
|
27
27
|
subject { @sample }
|
28
|
-
describe
|
29
|
-
before { Time.
|
30
|
-
context
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
its(:
|
35
|
-
its(:
|
36
|
-
its(:edition) { should == 1 }
|
37
|
-
its(:released_at) { should == now }
|
28
|
+
describe 'fixed default_values' do
|
29
|
+
before { allow(Time).to receive(:now).and_return(now) }
|
30
|
+
context 'without attributes' do
|
31
|
+
subject { Book1.new }
|
32
|
+
its(:title) { is_expected.to be_nil }
|
33
|
+
its(:price) { is_expected.to eq 0 }
|
34
|
+
its(:edition) { is_expected.to eq 1 }
|
35
|
+
its(:released_at) { is_expected.to eq now }
|
38
36
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
its(:
|
44
|
-
its(:
|
45
|
-
its(:
|
46
|
-
its(:released_at) { should == now }
|
37
|
+
|
38
|
+
context 'with attributes' do
|
39
|
+
subject { Book1.new(price: 100) }
|
40
|
+
its(:title) { is_expected.to be_nil }
|
41
|
+
its(:price) { is_expected.to eq 100 }
|
42
|
+
its(:edition) { is_expected.to eq 1 }
|
43
|
+
its(:released_at) { is_expected.to eq now }
|
47
44
|
end
|
48
|
-
context
|
49
|
-
|
50
|
-
|
45
|
+
context 'with block' do
|
46
|
+
subject do
|
47
|
+
Book1.new do |t|
|
51
48
|
t.title = 'foo'
|
52
49
|
end
|
53
50
|
end
|
54
|
-
its(:title) {
|
55
|
-
its(:price) {
|
56
|
-
its(:edition) {
|
57
|
-
its(:released_at) {
|
51
|
+
its(:title) { is_expected.to eq 'foo' }
|
52
|
+
its(:price) { is_expected.to eq 0 }
|
53
|
+
its(:edition) { is_expected.to eq 1 }
|
54
|
+
its(:released_at) { is_expected.to eq now }
|
58
55
|
end
|
59
56
|
|
60
57
|
if Rails.version.to_i < 4
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
its(:
|
66
|
-
its(:
|
67
|
-
its(:edition) { should == 1 }
|
68
|
-
its(:released_at) { should == now }
|
58
|
+
describe 'consider attr_protected' do
|
59
|
+
subject { Book1.new(edition: 3) }
|
60
|
+
its(:title) { is_expected.to be_nil }
|
61
|
+
its(:price) { is_expected.to eq 0 }
|
62
|
+
its(:edition) { is_expected.to eq 1 }
|
63
|
+
its(:released_at) { is_expected.to eq now }
|
69
64
|
end
|
70
65
|
end
|
71
66
|
end
|
72
67
|
|
73
|
-
describe
|
68
|
+
describe 'instance values with block' do
|
69
|
+
subject { Book2.new }
|
74
70
|
before do
|
75
|
-
@sample = Book2.new
|
76
71
|
sleep 1
|
77
72
|
@target = Book2.new
|
78
73
|
end
|
79
|
-
its(:released_at) {
|
74
|
+
its(:released_at) { is_expected.not_to eq @target.released_at }
|
80
75
|
end
|
81
76
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
its(:price) { should == 150 }
|
87
|
-
its(:edition) { should == 1 }
|
77
|
+
context 'both attr_accessible and attr_protected' do
|
78
|
+
subject { Book3.new(price: 150) }
|
79
|
+
its(:price) { is_expected.to eq 150 }
|
80
|
+
its(:edition) { is_expected.to eq 1 }
|
88
81
|
end
|
89
82
|
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/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -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 vendor/assets/javascripts of plugins, if any, 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/sstephenson/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 vendor/assets/stylesheets of plugins, if any, 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
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -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>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require 'ar_default_values'
|
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
|
+
end
|
22
|
+
end
|
@@ -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
|
@@ -0,0 +1,37 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Adds additional error checking when serving assets at runtime.
|
31
|
+
# Checks for improperly declared sprockets dependencies.
|
32
|
+
# Raises helpful error messages.
|
33
|
+
config.assets.raise_runtime_errors = true
|
34
|
+
|
35
|
+
# Raises error for missing translations
|
36
|
+
# config.action_view.raise_on_missing_translations = true
|
37
|
+
end
|