couch_rest_adapter 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +28 -0
- data/Rakefile +32 -0
- data/lib/couch_rest_adapter/attribute_method.rb +37 -0
- data/lib/couch_rest_adapter/db_config.rb +29 -0
- data/lib/couch_rest_adapter/document_management.rb +21 -0
- data/lib/couch_rest_adapter/helpers.rb +11 -0
- data/lib/couch_rest_adapter/query_views.rb +29 -0
- data/lib/couch_rest_adapter/railtie.rb +9 -0
- data/lib/couch_rest_adapter/version.rb +3 -0
- data/lib/couch_rest_adapter.rb +68 -0
- data/lib/exceptions/couch_rest_adapter.rb +8 -0
- data/lib/tasks/couch_rest_adapter_tasks.rake +4 -0
- data/test/couch_rest_adapter_test.rb +100 -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/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -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/config/application.rb +27 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +14 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -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 +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -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 +56 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/lib/couch_rest_adapter/railtie.rb +10 -0
- data/test/dummy/log/test.log +1290 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories.rb +8 -0
- data/test/test_helper.rb +36 -0
- metadata +198 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cfc5403241fb1a9255dc2bdffdfcd28adf3254b7
|
4
|
+
data.tar.gz: b93f5a093db645f00650b43e7c5d68143b76dd80
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f7a72c34f1da276865262864334105cca4007123307028ac075cb1ccee0b81743e2ccb2762c6f6cd3ec551e2681e29df048d08aaa0319558339af67059ab78c2
|
7
|
+
data.tar.gz: 10538a8ba87daedc23cb76ca7299d58cf870e2a35d734d65d624c569584bc8f60507a66b808e62de373ffc706fbfd8553932e44f86df8e4f7deab5d5666bddaf
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
= CouchRestAdapter
|
2
|
+
|
3
|
+
This project rocks and uses MIT-LICENSE.
|
4
|
+
|
5
|
+
== Requirements
|
6
|
+
|
7
|
+
* Rails > 4
|
8
|
+
* Couchrest
|
9
|
+
* Requires config/database.yml file
|
10
|
+
|
11
|
+
|
12
|
+
== Instalation
|
13
|
+
|
14
|
+
=== In Gemfile
|
15
|
+
|
16
|
+
gem 'couch_rest_adapter', git: 'https://github.com:amco/couch_rest_adapter.git'
|
17
|
+
|
18
|
+
=== Model Declaration
|
19
|
+
|
20
|
+
|
21
|
+
class User < CouchRestAdpater::Base
|
22
|
+
use_default_database
|
23
|
+
end
|
24
|
+
|
25
|
+
=== TODO
|
26
|
+
|
27
|
+
* Allow setting new attributes with ```model.attribute = value```
|
28
|
+
* More test coverage
|
data/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
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
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'CouchRestAdapter'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rake/testtask'
|
23
|
+
|
24
|
+
Rake::TestTask.new(:test) do |t|
|
25
|
+
t.libs << 'lib'
|
26
|
+
t.libs << 'test'
|
27
|
+
t.pattern = 'test/**/*_test.rb'
|
28
|
+
t.verbose = false
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task default: :test
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module CouchRestAdapter
|
2
|
+
module AttributeMethod
|
3
|
+
|
4
|
+
def read_write method, value = nil
|
5
|
+
writer?(method) ? write_value(method, value) : read_value(method)
|
6
|
+
end
|
7
|
+
|
8
|
+
def read_value method_name
|
9
|
+
singleton_class.class_eval do
|
10
|
+
define_method(method_name) { self[method_name] }
|
11
|
+
end
|
12
|
+
send(method_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
def write_value method_name, value
|
16
|
+
base_method_name = method_without_equals(method_name)
|
17
|
+
singleton_class.class_eval do
|
18
|
+
define_method(method_name){ |v| self[base_method_name] = v }
|
19
|
+
end
|
20
|
+
send(method_name, value)
|
21
|
+
end
|
22
|
+
|
23
|
+
def method_without_equals method_name
|
24
|
+
method_name.to_s.sub(/=$/,'').to_sym
|
25
|
+
end
|
26
|
+
|
27
|
+
def writer? method_name
|
28
|
+
method_name =~ /=$/
|
29
|
+
end
|
30
|
+
|
31
|
+
def attribute_methods
|
32
|
+
_attributes.keys.map{ |attr| [attr, "#{attr}="] }.flatten
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CouchRestAdapter
|
2
|
+
module DbConfig
|
3
|
+
def self.included(base)
|
4
|
+
base.extend ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
attr_accessor :config_file
|
9
|
+
|
10
|
+
def parse_config
|
11
|
+
YAML::load File.open config_file
|
12
|
+
end
|
13
|
+
|
14
|
+
def base_path
|
15
|
+
parts = parse_config[Rails.env]
|
16
|
+
"#{parts['protocol']}://#{parts['host']}:#{parts['port']}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def full_path
|
20
|
+
"#{base_path}/#{parse_config[Rails.env]['name']}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def config_file
|
24
|
+
root = Rails.env == 'test' ? File.expand_path("../../../test/dummy/", __FILE__) : Rails.root
|
25
|
+
File.join(root, 'config', 'database.yml')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module CouchRestAdapter
|
2
|
+
module DocumentManagement
|
3
|
+
UUID_DOC = '_uuids/?'
|
4
|
+
|
5
|
+
def next_id
|
6
|
+
File.join self.class.model_name, uuids.first
|
7
|
+
end
|
8
|
+
|
9
|
+
def uuids opts = {}
|
10
|
+
uuid_doc = File.join UUID_DOC, query(opts)
|
11
|
+
uuids_path = File.join CouchRestAdapter::Base.base_path, uuid_doc
|
12
|
+
CouchRest.get( uuids_path )["uuids"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def query opts = {}
|
16
|
+
CGI.unescape(opts.to_query)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'couch_rest_adapter/helpers'
|
2
|
+
|
3
|
+
using CouchRestAdapter::Helpers
|
4
|
+
|
5
|
+
module CouchRestAdapter
|
6
|
+
module QueryViews
|
7
|
+
|
8
|
+
def self.included(base)
|
9
|
+
base.extend(ClassMethods)
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
#TODO: We can get this from Rails.application.class.name
|
14
|
+
DEFAULT_DESIGN = 'amcoid'
|
15
|
+
|
16
|
+
def query_view name
|
17
|
+
doc = name.namespace_me DEFAULT_DESIGN
|
18
|
+
view(doc, {key: model_name})['rows'].map{ |res| new res['doc'] }
|
19
|
+
end
|
20
|
+
|
21
|
+
#TODO: method for reduce, and filters
|
22
|
+
def view doc, attrs, reduce = false
|
23
|
+
database.view(doc, {reduce: reduce, include_docs: true}.merge!(attrs) )
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'couchrest'
|
2
|
+
require 'couch_rest_adapter/attribute_method'
|
3
|
+
require 'couch_rest_adapter/query_views'
|
4
|
+
require 'couch_rest_adapter/document_management'
|
5
|
+
require 'couch_rest_adapter/db_config'
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), '/exceptions/couch_rest_adapter')
|
8
|
+
|
9
|
+
using CouchRestAdapter::Helpers
|
10
|
+
|
11
|
+
module CouchRestAdapter
|
12
|
+
class Base < CouchRest::Document
|
13
|
+
include ActiveSupport::Callbacks
|
14
|
+
include AttributeMethod
|
15
|
+
include QueryViews
|
16
|
+
include DocumentManagement
|
17
|
+
include DbConfig
|
18
|
+
|
19
|
+
#TODO: add custom callback calls.
|
20
|
+
define_callbacks :before_save
|
21
|
+
|
22
|
+
def initialize attrs = nil
|
23
|
+
raise NotImplementedError if abstract?
|
24
|
+
super attrs
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.all
|
28
|
+
query_view('all')
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.all_by_type
|
32
|
+
query_view('by_type')
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.find doc_id
|
36
|
+
new database.get( doc_id.namespace_me(model_name) ).to_hash
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.use_default_database
|
40
|
+
use_database CouchRest.database(full_path)
|
41
|
+
end
|
42
|
+
|
43
|
+
def save
|
44
|
+
run_callbacks :before_save do
|
45
|
+
self['_id'] = next_id if self['_id'].blank?
|
46
|
+
super
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def method_missing method, *args, &block
|
51
|
+
if attribute_methods.include? method.to_s
|
52
|
+
read_write method, args.first
|
53
|
+
else
|
54
|
+
super
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
protected
|
59
|
+
def abstract?
|
60
|
+
self.class.to_s == 'CouchRestAdapter::Base'
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.model_name
|
64
|
+
name.underscore
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FooBar < CouchRestAdapter::Base
|
4
|
+
use_default_database
|
5
|
+
end
|
6
|
+
|
7
|
+
class CouchRestAdapterTest < ActiveSupport::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
resp = {ok: true, id: "foo_bar/1", rev: "FF0000"}
|
11
|
+
FakeWeb.register_uri :put, %r|http://.*:5984/test/.*|, body: resp.to_json
|
12
|
+
|
13
|
+
get_resp = {_id: 'foo_bar/1', _rev: 'FF0000', foo: 'Foo', bar: 'Bar'}
|
14
|
+
|
15
|
+
FakeWeb.register_uri :get, %r|http://.*:5984/test/foo_bar.*|, body: get_resp.to_json
|
16
|
+
|
17
|
+
view_by_type_resp = {
|
18
|
+
total_rows:579,
|
19
|
+
offset:0,
|
20
|
+
rows:[
|
21
|
+
{
|
22
|
+
id:"foo_bar/1",
|
23
|
+
key: "foo_bar",
|
24
|
+
value: {_id: "foo_bar/1", _rev: "FF0000", foo: 'Foo', bar: 'Bar', type: 'foo_bar'},
|
25
|
+
doc: {_id: "foo_bar/1", _rev: "FF0000", foo: 'Foo', bar: 'Bar', type: 'foo_bar'}
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
29
|
+
|
30
|
+
view_resp = {
|
31
|
+
total_rows:579,
|
32
|
+
offset:0,
|
33
|
+
rows:[
|
34
|
+
{
|
35
|
+
id:"foo_bar/1",
|
36
|
+
key: "foo_bar",
|
37
|
+
value: {_id: "foo_bar/1", _rev: "FF0000", foo: 'Foo', bar: 'Bar'},
|
38
|
+
doc: {_id: "foo_bar/1", _rev: "FF0000", foo: 'Foo', bar: 'Bar'}
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
|
43
|
+
FakeWeb.register_uri :get, %r|http://.*:5984/test/_design/.*/_view/all.*key=%22foo_bar%22|, body: view_resp.to_json
|
44
|
+
|
45
|
+
FakeWeb.register_uri :get, %r|http://.*:5984/test/_design/.*/_view/by_type.*key=%22foo_bar%22|, body: view_by_type_resp.to_json
|
46
|
+
|
47
|
+
@foo = FooBar.new foo: 'Foo', bar: 'Bar'
|
48
|
+
@foo.save
|
49
|
+
end
|
50
|
+
|
51
|
+
test 'can not instantiate base class' do
|
52
|
+
assert_raise CouchRestAdapter::NotImplementedError do
|
53
|
+
CouchRestAdapter::Base.new
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
test 'will add class underscorename to id' do
|
58
|
+
assert @foo.id =~ /foo_bar/
|
59
|
+
end
|
60
|
+
|
61
|
+
test 'attributes are available as methods' do
|
62
|
+
assert_equal 'Bar', @foo.bar
|
63
|
+
assert_equal 'Foo', @foo.foo
|
64
|
+
end
|
65
|
+
|
66
|
+
test 'one can update existing attributes' do
|
67
|
+
@foo.foo = 'more'
|
68
|
+
assert_equal 'more', @foo[:foo]
|
69
|
+
end
|
70
|
+
|
71
|
+
test 'update to attr= will persist' do
|
72
|
+
skip "Need to test update methods with mock requests."
|
73
|
+
end
|
74
|
+
|
75
|
+
test 'query all will bring array of Foo instances' do
|
76
|
+
foos = FooBar.all
|
77
|
+
foos.each do |f|
|
78
|
+
assert f.kind_of?(FooBar)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
test 'query all_by_type will return array of docs with type set to model name' do
|
83
|
+
bar = FooBar.new foo: 'Bar', bar: 'Foo', type: 'foo_bar'
|
84
|
+
bar.save
|
85
|
+
bars = FooBar.all_by_type
|
86
|
+
bars.each do |doc|
|
87
|
+
assert doc.kind_of?(FooBar)
|
88
|
+
assert_equal 'foo_bar', doc.type
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
test 'find will work with partial id' do
|
93
|
+
partial_id = @foo.id.sub(/foo\//,'')
|
94
|
+
assert_equal @foo, FooBar.find(partial_id)
|
95
|
+
end
|
96
|
+
|
97
|
+
#TODO: Error handling, reporting
|
98
|
+
|
99
|
+
end
|
100
|
+
|
@@ -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 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,13 @@
|
|
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 top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -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/test/dummy/bin/rake
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
require "sprockets/railtie"
|
6
|
+
require "rails/test_unit/railtie"
|
7
|
+
|
8
|
+
Bundler.require(*Rails.groups)
|
9
|
+
require "couch_rest_adapter"
|
10
|
+
|
11
|
+
module Dummy
|
12
|
+
class Application < Rails::Application
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration should go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
16
|
+
config.autoload_paths += %W(#{config.root}/lib/couch_rest_adapter)
|
17
|
+
|
18
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
19
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
20
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
21
|
+
|
22
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
23
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
24
|
+
# config.i18n.default_locale = :de
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Dummy::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
|
+
end
|