active_hash_relation 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +15 -0
- data/README.md +68 -11
- data/active_hash_relation.gemspec +13 -0
- data/lib/active_hash_relation.rb +18 -12
- data/lib/active_hash_relation/aggregation.rb +3 -0
- data/lib/active_hash_relation/association_filters.rb +3 -0
- data/lib/active_hash_relation/column_filters.rb +45 -11
- data/lib/active_hash_relation/filter_applier.rb +37 -23
- data/lib/active_hash_relation/helpers.rb +22 -2
- data/lib/active_hash_relation/scope_filters.rb +8 -1
- data/lib/active_hash_relation/sort_filters.rb +12 -0
- data/lib/active_hash_relation/version.rb +1 -1
- data/lib/active_record/scope_names.rb +4 -19
- data/lib/generators/active_hash_relation/initialize_generator.rb +13 -0
- data/lib/generators/active_hash_relation/templates/active_hash_relation.rb +12 -0
- data/spec/config/initializers/active_hash_relation.rb +16 -0
- data/spec/db/migrate/001_basic_schema.rb +53 -0
- data/spec/dummy-rails4/.gitignore +13 -0
- data/spec/dummy-rails4/.ruby-version +1 -0
- data/spec/dummy-rails4/Gemfile +18 -0
- data/spec/dummy-rails4/README.md +3 -0
- data/spec/dummy-rails4/Rakefile +6 -0
- data/spec/dummy-rails4/app/controllers/application_controller.rb +5 -0
- data/spec/dummy-rails4/app/models/.keep +0 -0
- data/spec/dummy-rails4/app/models/address.rb +1 -0
- data/spec/dummy-rails4/app/models/micropost.rb +1 -0
- data/spec/dummy-rails4/app/models/relationship.rb +1 -0
- data/spec/dummy-rails4/app/models/user.rb +1 -0
- data/spec/dummy-rails4/bin/bundle +3 -0
- data/spec/dummy-rails4/bin/rails +4 -0
- data/spec/dummy-rails4/bin/rake +4 -0
- data/spec/dummy-rails4/bin/setup +29 -0
- data/spec/dummy-rails4/config.ru +4 -0
- data/spec/dummy-rails4/config/application.rb +35 -0
- data/spec/dummy-rails4/config/boot.rb +3 -0
- data/spec/dummy-rails4/config/database.yml +18 -0
- data/spec/dummy-rails4/config/environment.rb +5 -0
- data/spec/dummy-rails4/config/environments/development.rb +41 -0
- data/spec/dummy-rails4/config/environments/production.rb +79 -0
- data/spec/dummy-rails4/config/environments/test.rb +42 -0
- data/spec/dummy-rails4/config/initializers/active_hash_relation.rb +3 -0
- data/spec/dummy-rails4/config/initializers/assets.rb +11 -0
- data/spec/dummy-rails4/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy-rails4/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy-rails4/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy-rails4/config/initializers/inflections.rb +16 -0
- data/spec/dummy-rails4/config/initializers/mime_types.rb +4 -0
- data/spec/dummy-rails4/config/initializers/session_store.rb +3 -0
- data/spec/dummy-rails4/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy-rails4/config/locales/en.yml +23 -0
- data/spec/dummy-rails4/config/routes.rb +56 -0
- data/spec/dummy-rails4/config/secrets.yml +22 -0
- data/spec/dummy-rails4/db/migrate/001_basic_schema.rb +1 -0
- data/spec/dummy-rails4/db/schema.rb +69 -0
- data/spec/dummy-rails4/spec/factories/factories.rb +1 -0
- data/spec/dummy-rails4/spec/rails_helper.rb +19 -0
- data/spec/dummy-rails4/spec/spec_helper.rb +99 -0
- data/spec/dummy-rails4/spec/support/support.rb +1 -0
- data/spec/dummy-rails4/spec/tests/tests_spec.rb +3 -0
- data/spec/dummy-rails5/.gitignore +17 -0
- data/spec/dummy-rails5/.rspec +2 -0
- data/spec/dummy-rails5/.ruby-version +1 -0
- data/spec/dummy-rails5/Gemfile +19 -0
- data/spec/dummy-rails5/README.md +3 -0
- data/spec/dummy-rails5/Rakefile +6 -0
- data/spec/dummy-rails5/app/controllers/application_controller.rb +3 -0
- data/spec/dummy-rails5/app/models/address.rb +1 -0
- data/spec/dummy-rails5/app/models/micropost.rb +1 -0
- data/spec/dummy-rails5/app/models/relationship.rb +1 -0
- data/spec/dummy-rails5/app/models/user.rb +1 -0
- data/spec/dummy-rails5/bin/bundle +3 -0
- data/spec/dummy-rails5/bin/rails +4 -0
- data/spec/dummy-rails5/bin/rake +4 -0
- data/spec/dummy-rails5/bin/setup +34 -0
- data/spec/dummy-rails5/bin/update +29 -0
- data/spec/dummy-rails5/config.ru +5 -0
- data/spec/dummy-rails5/config/application.rb +25 -0
- data/spec/dummy-rails5/config/boot.rb +3 -0
- data/spec/dummy-rails5/config/cable.yml +9 -0
- data/spec/dummy-rails5/config/database.yml +18 -0
- data/spec/dummy-rails5/config/environment.rb +5 -0
- data/spec/dummy-rails5/config/environments/development.rb +54 -0
- data/spec/dummy-rails5/config/environments/production.rb +86 -0
- data/spec/dummy-rails5/config/environments/test.rb +42 -0
- data/spec/dummy-rails5/config/initializers/active_hash_relation.rb +3 -0
- data/spec/dummy-rails5/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/dummy-rails5/config/initializers/assets.rb +11 -0
- data/spec/dummy-rails5/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy-rails5/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy-rails5/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy-rails5/config/initializers/inflections.rb +16 -0
- data/spec/dummy-rails5/config/initializers/mime_types.rb +4 -0
- data/spec/dummy-rails5/config/initializers/new_framework_defaults.rb +24 -0
- data/spec/dummy-rails5/config/initializers/session_store.rb +3 -0
- data/spec/dummy-rails5/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy-rails5/config/locales/en.yml +23 -0
- data/spec/dummy-rails5/config/puma.rb +47 -0
- data/spec/dummy-rails5/config/routes.rb +3 -0
- data/spec/dummy-rails5/config/secrets.yml +22 -0
- data/spec/dummy-rails5/config/spring.rb +6 -0
- data/spec/dummy-rails5/db/migrate/001_basic_schema.rb +2 -0
- data/spec/dummy-rails5/db/schema.rb +64 -0
- data/spec/dummy-rails5/spec/factories/factories.rb +1 -0
- data/spec/dummy-rails5/spec/rails_helper.rb +19 -0
- data/spec/dummy-rails5/spec/spec_helper.rb +99 -0
- data/spec/dummy-rails5/spec/support/support.rb +1 -0
- data/spec/dummy-rails5/spec/tests/tests_spec.rb +3 -0
- data/spec/factories/factories.rb +39 -0
- data/spec/models/address.rb +7 -0
- data/spec/models/application_record.rb +3 -0
- data/spec/models/micropost.rb +9 -0
- data/spec/models/relationship.rb +9 -0
- data/spec/models/user.rb +32 -0
- data/spec/support/support.rb +62 -0
- data/spec/tests/aggregations/avg_spec.rb +45 -0
- data/spec/tests/aggregations/max_spec.rb +45 -0
- data/spec/tests/aggregations/min_spec.rb +46 -0
- data/spec/tests/aggregations/sum_spec.rb +43 -0
- data/spec/tests/associations/belongs_to_spec.rb +96 -0
- data/spec/tests/associations/has_many_spec.rb +91 -0
- data/spec/tests/associations/has_one_spec.rb +89 -0
- data/spec/tests/booleans_spec.rb +29 -0
- data/spec/tests/limit_spec.rb +30 -0
- data/spec/tests/null_spec.rb +44 -0
- data/spec/tests/numbers_spec.rb +142 -0
- data/spec/tests/or_filter_spec.rb +98 -0
- data/spec/tests/primary_key_spec.rb +29 -0
- data/spec/tests/scopes_spec.rb +48 -0
- data/spec/tests/sorting_spec.rb +100 -0
- data/spec/tests/strings_spec.rb +86 -0
- metadata +392 -4
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
module ActiveHashRelation
|
|
2
2
|
module Helpers
|
|
3
|
-
def model_class_name(resource)
|
|
4
|
-
resource.class.to_s.split('::')
|
|
3
|
+
def model_class_name(resource, _engine = false)
|
|
4
|
+
_class = resource.class.to_s.split('::')
|
|
5
|
+
if _engine === true
|
|
6
|
+
"#{_class[0]}::#{_class[1]}".constantize
|
|
7
|
+
else
|
|
8
|
+
_class.first.constantize
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def engine_name
|
|
13
|
+
Rails::Engine.subclasses[0].to_s.split('::').first
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def find_model(model)
|
|
17
|
+
return model if model
|
|
18
|
+
|
|
19
|
+
model = model_class_name(@resource)
|
|
20
|
+
if model.nil? || engine_name == model.to_s
|
|
21
|
+
model = model_class_name(@resource, true)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
return model
|
|
5
25
|
end
|
|
6
26
|
end
|
|
7
27
|
end
|
|
@@ -2,11 +2,18 @@ module ActiveHashRelation::ScopeFilters
|
|
|
2
2
|
def filter_scopes(resource, params, model = nil)
|
|
3
3
|
unless model
|
|
4
4
|
model = model_class_name(resource)
|
|
5
|
+
if model.nil? || engine_name == model.to_s
|
|
6
|
+
model = model_class_name(resource, true)
|
|
7
|
+
end
|
|
5
8
|
end
|
|
6
9
|
|
|
7
10
|
model.scope_names.each do |scope|
|
|
8
11
|
if params.include?(scope)
|
|
9
|
-
|
|
12
|
+
if params[scope].is_a? Array
|
|
13
|
+
resource = resource.send(scope, *params[scope])
|
|
14
|
+
else
|
|
15
|
+
resource = resource.send(scope)
|
|
16
|
+
end
|
|
10
17
|
end
|
|
11
18
|
end
|
|
12
19
|
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
module ActiveHashRelation::SortFilters
|
|
2
2
|
def apply_sort(resource, params, model = nil)
|
|
3
|
+
if params.is_a? Array
|
|
4
|
+
params.each do |param_item|
|
|
5
|
+
resource = apply_hash_sort(resource, param_item, model)
|
|
6
|
+
end
|
|
7
|
+
else
|
|
8
|
+
resource = apply_hash_sort(resource, params, model)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
return resource
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def apply_hash_sort(resource, params, model = nil)
|
|
3
15
|
if model.columns.map(&:name).include?(params[:property].to_s)
|
|
4
16
|
resource = resource.order(params[:property] => (params[:order] || :desc) )
|
|
5
17
|
end
|
|
@@ -4,29 +4,14 @@ module ActiveRecord
|
|
|
4
4
|
module ClassMethods
|
|
5
5
|
attr_reader :scope_names
|
|
6
6
|
|
|
7
|
+
alias_method :_scope, :scope
|
|
8
|
+
|
|
7
9
|
def scope(name, body, &block)
|
|
8
10
|
@scope_names ||= []
|
|
9
|
-
unless body.respond_to?(:call)
|
|
10
|
-
raise ArgumentError, 'The scope body needs to be callable.'
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
if dangerous_class_method?(name)
|
|
14
|
-
raise ArgumentError, "You tried to define a scope named \"#{name}\" " \
|
|
15
|
-
"on the model \"#{self.name}\", but Active Record already defined " \
|
|
16
|
-
"a class method with the same name."
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
extension = Module.new(&block) if block
|
|
20
|
-
|
|
21
|
-
singleton_class.send(:define_method, name) do |*args|
|
|
22
|
-
scope = all.scoping { body.call(*args) }
|
|
23
|
-
scope = scope.extending(extension) if extension
|
|
24
|
-
|
|
25
|
-
scope || all
|
|
26
|
-
end
|
|
27
11
|
|
|
12
|
+
_scope(name, body, &block)
|
|
28
13
|
|
|
29
|
-
@scope_names << name
|
|
14
|
+
@scope_names << name
|
|
30
15
|
end
|
|
31
16
|
end
|
|
32
17
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module ActiveHashRelation
|
|
2
|
+
module Generators
|
|
3
|
+
class InitializeGenerator < Rails::Generators::Base
|
|
4
|
+
desc "This generator creates an initializer file at config/initializers"
|
|
5
|
+
|
|
6
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
|
7
|
+
|
|
8
|
+
def create_initializer_file
|
|
9
|
+
template 'active_hash_relation.rb', 'config/initializers/active_hash_relation.rb'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
ActiveHashRelation.configure do |config|
|
|
2
|
+
#override default scope when accessing associations
|
|
3
|
+
config.use_unscoped = true
|
|
4
|
+
#set true to be able to filter scopes (with params)
|
|
5
|
+
#please note that unfortunately (:/) rails does not provide any way
|
|
6
|
+
#to iterate through scopes so it uses a monkey patch
|
|
7
|
+
#You need to run `initialize!` to actually include the required files
|
|
8
|
+
config.filter_active_record_scopes = false
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
#requires monkeyparched scopes, optional if you don't enable them
|
|
12
|
+
ActiveHashRelation.initialize!
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ARH_INITIALIZER = proc{
|
|
2
|
+
ActiveHashRelation.configure do |config|
|
|
3
|
+
#override default scope when accessing associations
|
|
4
|
+
config.use_unscoped = true
|
|
5
|
+
#set true to be able to filter scopes (with params)
|
|
6
|
+
#please note that unfortunately (:/) rails does not provide any way
|
|
7
|
+
#to iterate through scopes so it uses a monkey patch.
|
|
8
|
+
#The monkey patch is as gentle as it can be by aliasing the method, adds some
|
|
9
|
+
#sugar and calls it
|
|
10
|
+
#You need to run `initialize!` to actually include the required files
|
|
11
|
+
config.filter_active_record_scopes = true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
#requires monkeyparched scopes, optional if you don't enable them
|
|
15
|
+
ActiveHashRelation.initialize!
|
|
16
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
class BasicSchema < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table "microposts", force: :cascade do |t|
|
|
4
|
+
t.text "content", null: false
|
|
5
|
+
t.integer "user_id", null: false
|
|
6
|
+
t.integer "likes", null: false, default: 0
|
|
7
|
+
t.integer "reposts", null: false, default: 0
|
|
8
|
+
t.integer "status", null: false, default: 0
|
|
9
|
+
|
|
10
|
+
t.timestamps null: false
|
|
11
|
+
|
|
12
|
+
t.index ["user_id"], name: "index_microposts_on_user_id", using: :btree
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
create_table "relationships", force: :cascade do |t|
|
|
16
|
+
t.integer "follower_id"
|
|
17
|
+
t.integer "followed_id"
|
|
18
|
+
|
|
19
|
+
t.timestamps null: false
|
|
20
|
+
|
|
21
|
+
t.index ["followed_id"], name: "index_relationships_on_followed_id", using: :btree
|
|
22
|
+
t.index ["follower_id", "followed_id"], name: "index_relationships_on_follower_id_and_followed_id", unique: true, using: :btree
|
|
23
|
+
t.index ["follower_id"], name: "index_relationships_on_follower_id", using: :btree
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
create_table "users", force: :cascade do |t|
|
|
27
|
+
t.string "name"
|
|
28
|
+
t.string "email", null: false
|
|
29
|
+
t.boolean "admin", default: false
|
|
30
|
+
t.boolean "verified", default: false
|
|
31
|
+
t.string "token", null: false
|
|
32
|
+
t.integer "microposts_count", default: 0, null: false
|
|
33
|
+
t.integer "followers_count", default: 0, null: false
|
|
34
|
+
t.integer "followings_count", default: 0, null: false
|
|
35
|
+
|
|
36
|
+
t.timestamps null: false
|
|
37
|
+
|
|
38
|
+
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
create_table :addresses do |t|
|
|
42
|
+
t.string :street
|
|
43
|
+
t.string :city
|
|
44
|
+
t.string :country
|
|
45
|
+
t.integer :user_id
|
|
46
|
+
|
|
47
|
+
t.timestamps
|
|
48
|
+
t.index ["user_id"], name: "index_addresses_on_user_id", unique: true, using: :btree
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
add_foreign_key "microposts", "users"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config.
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore all logfiles and tempfiles.
|
|
11
|
+
/log/*
|
|
12
|
+
!/log/.keep
|
|
13
|
+
/tmp
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-2.3.3
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
ruby "2.3.3"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
gem 'rails', '4.2.7'
|
|
7
|
+
gem 'pg', '~> 0.15'
|
|
8
|
+
|
|
9
|
+
group :development, :test do
|
|
10
|
+
gem 'rspec-rails', '~> 3.5'
|
|
11
|
+
gem 'database_cleaner'
|
|
12
|
+
gem 'factory_girl_rails'
|
|
13
|
+
gem 'pry-rails'
|
|
14
|
+
gem 'faker'
|
|
15
|
+
gem 'listen'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
gem 'active_hash_relation', path: '../../'
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative '../../../models/address'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative '../../../models/micropost'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative '../../../models/relationship'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative '../../../models/user'
|
|
@@ -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,35 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require "rails"
|
|
4
|
+
# Pick the frameworks you want:
|
|
5
|
+
require "active_model/railtie"
|
|
6
|
+
require "active_job/railtie"
|
|
7
|
+
require "active_record/railtie"
|
|
8
|
+
require "action_controller/railtie"
|
|
9
|
+
require "action_mailer/railtie"
|
|
10
|
+
require "action_view/railtie"
|
|
11
|
+
require "sprockets/railtie"
|
|
12
|
+
# require "rails/test_unit/railtie"
|
|
13
|
+
|
|
14
|
+
# Require the gems listed in Gemfile, including any gems
|
|
15
|
+
# you've limited to :test, :development, or :production.
|
|
16
|
+
Bundler.require(*Rails.groups)
|
|
17
|
+
|
|
18
|
+
module DummyRails4
|
|
19
|
+
class Application < Rails::Application
|
|
20
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
21
|
+
# Application configuration should go into files in config/initializers
|
|
22
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
23
|
+
|
|
24
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
25
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
26
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
27
|
+
|
|
28
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
29
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
30
|
+
# config.i18n.default_locale = :de
|
|
31
|
+
|
|
32
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
|
33
|
+
config.active_record.raise_in_transactional_callbacks = true
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
default: &default
|
|
2
|
+
adapter: postgresql
|
|
3
|
+
encoding: unicode
|
|
4
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
5
|
+
|
|
6
|
+
development:
|
|
7
|
+
<<: *default
|
|
8
|
+
database: dummy_rails4_development
|
|
9
|
+
|
|
10
|
+
test:
|
|
11
|
+
<<: *default
|
|
12
|
+
database: dummy_raills4_test
|
|
13
|
+
|
|
14
|
+
production:
|
|
15
|
+
<<: *default
|
|
16
|
+
database: dummy_rails4_production
|
|
17
|
+
username: dummy
|
|
18
|
+
password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
|
31
|
+
# yet still be able to expire them through the digest params.
|
|
32
|
+
config.assets.digest = true
|
|
33
|
+
|
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
|
36
|
+
# Raises helpful error messages.
|
|
37
|
+
config.assets.raise_runtime_errors = true
|
|
38
|
+
|
|
39
|
+
# Raises error for missing translations
|
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
|
41
|
+
end
|