replication 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +120 -0
  6. data/Rakefile +13 -0
  7. data/db/migrate/714417722_replication_migration.rb +15 -0
  8. data/lib/replication/active_record/strand.rb +13 -0
  9. data/lib/replication/config.rb +21 -0
  10. data/lib/replication/engine.rb +5 -0
  11. data/lib/replication/modules/proofreading.rb +27 -0
  12. data/lib/replication/modules/semi_conservative.rb +35 -0
  13. data/lib/replication/process.rb +57 -0
  14. data/lib/replication/strand_methods.rb +16 -0
  15. data/lib/replication/version.rb +3 -0
  16. data/lib/replication.rb +27 -0
  17. data/replication.gemspec +24 -0
  18. data/test/orm/active_record.rb +10 -0
  19. data/test/rails_app/Rakefile +6 -0
  20. data/test/rails_app/app/models/.keep +0 -0
  21. data/test/rails_app/app/models/concerns/.keep +0 -0
  22. data/test/rails_app/app/models/organism.rb +3 -0
  23. data/test/rails_app/config/application.rb +34 -0
  24. data/test/rails_app/config/boot.rb +3 -0
  25. data/test/rails_app/config/database.yml +22 -0
  26. data/test/rails_app/config/environment.rb +5 -0
  27. data/test/rails_app/config/environments/test.rb +37 -0
  28. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/rails_app/config/initializers/cookies_serializer.rb +3 -0
  30. data/test/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  31. data/test/rails_app/config/initializers/inflections.rb +16 -0
  32. data/test/rails_app/config/initializers/mime_types.rb +4 -0
  33. data/test/rails_app/config/initializers/session_store.rb +3 -0
  34. data/test/rails_app/config/initializers/wrap_parameters.rb +14 -0
  35. data/test/rails_app/config/routes.rb +56 -0
  36. data/test/rails_app/config/secrets.yml +22 -0
  37. data/test/rails_app/config.ru +4 -0
  38. data/test/rails_app/db/migrate/830335961_organism_migration.rb +15 -0
  39. data/test/rails_app/log/test.log +1476 -0
  40. data/test/replication/modules/proofreading_test.rb +22 -0
  41. data/test/replication/modules/semi_conservative_test.rb +24 -0
  42. data/test/replication/process_test.rb +51 -0
  43. data/test/replication_test.rb +9 -0
  44. data/test/test_helper.rb +11 -0
  45. metadata +142 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9ada82be8564e12051c19fa8afab7242f5c5198f
4
+ data.tar.gz: 2fd0e08bc5bb4791297526988517c5ce22a018ad
5
+ SHA512:
6
+ metadata.gz: 8e22185640c920637bc17646668b92733cc7564f58e0115652937e94fc04efff01d53abf0885c07133ffbdaad35e84d663abad1261328b49ee7903c61dd4cfdd
7
+ data.tar.gz: a3a54381d5322affc1bf64d031daea478514e7cff9263bb90c55b48295e53cb6dc0523b5091a56a87397877e14c1e1c5b0ca196e3530f8eef0ce1490f57466e9
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
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
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'orm_adapter', '~> 0.5'
6
+ gem 'rails', '~> 4.0.5'
7
+
8
+ group :test do
9
+ gem 'minitest-reporters'
10
+ end
11
+
12
+ platforms :ruby do
13
+ gem 'sqlite3'
14
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Rodrigo DeAlmeida
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # Replication
2
+
3
+ Data replication as templates for Ruby ORMs.
4
+
5
+ > ![DNA]
6
+ >
7
+ > DNA replication. The [double helix][] is unwound and each strand acts as a template for the next strand. [Bases][] are matched to synthesize the new partner strands.
8
+
9
+ [DNA]: https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/DNA_replication_split.svg/200px-DNA_replication_split.svg.png
10
+ [double helix]: https://en.wikipedia.org/wiki/Double_helix "Double helix"
11
+ [Bases]: https://en.wikipedia.org/wiki/Nucleotides "Nucleotides"
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'replication'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install replication
26
+
27
+ ## Usage
28
+
29
+ Extend ```Replication::Process``` in your models and declare it.
30
+ ```ruby
31
+ class Model
32
+ extend Replication::Process
33
+ can_replicate
34
+ end
35
+ ```
36
+
37
+ Customize the 'pairs' method if you want.
38
+ ```ruby
39
+ class Model
40
+ extend Replication::Process
41
+ can_replicate :attributes_alias # default method is 'attributes'
42
+ end
43
+ ```
44
+
45
+ Customize the class of the strands if you want.
46
+ ```ruby
47
+ class Model
48
+ extend Replication::Process
49
+ can_replicate strand_class: WeirdStrandClass
50
+ end
51
+ ```
52
+
53
+ You can blacklist an array of attributes. They'll not be replicated in the new strand.
54
+ ```ruby
55
+ can_replicate except: [:id, :name]
56
+ ```
57
+
58
+ To 'unwound' a strand, do:
59
+ ```ruby
60
+ model_instance = Model.new(attrs)
61
+ model_instance.unwound(name: 'The Original Model') # returns a new strand
62
+ ```
63
+
64
+ To 'unwound' and save a strand, do:
65
+ ```ruby
66
+ model_instance = Model.new(attrs)
67
+ model_instance.replicate(name: 'The Original Model') # returns a new persisted strand
68
+ ```
69
+
70
+ To be able to 'unwound' only when the object is valid, include Proofreading.
71
+ Right now it needs a ```valid?``` method to check.
72
+ ```ruby
73
+ class Model
74
+ extend Replication::Process
75
+ can_replicate with: :proofreading
76
+ end
77
+
78
+ model_instance = Model.new(invalid_attrs)
79
+ model_instance.unwound(name: 'The Original Model') # returns nil
80
+ model_instance.replicate(name: 'The Original Model') # raises UnwoundError
81
+ ```
82
+
83
+ To initialize a object that's descendant from the strand of another object, do:
84
+ ```ruby
85
+ Model.new_from_strand([name or id])
86
+ # or
87
+ strand.replicate
88
+ ```
89
+
90
+ ### ActiveRecord
91
+
92
+ For ActiveRecord strands, ```[:id, :created_at, :updated_at]``` will be blacklisted by default.
93
+
94
+ It's highly recommended that you save your model instances before trying to replicate, since it
95
+ needs the 'id' and 'type' references for the association.
96
+
97
+ In some cases you don't want/won't need the strands to be associated, so, be free.
98
+
99
+ ### Rails
100
+
101
+ Migrations are be provided by:
102
+ ```
103
+ rake replication_engine:install:migrations
104
+ ```
105
+
106
+ ## TODO
107
+
108
+ - Add ActiveRecord inverse association: 'strands'.
109
+ - Refactoring, mainly about dependencies.
110
+ - Thorough testing.
111
+ - Scoping.
112
+ - More ORMs/ODMs.
113
+
114
+ ## Contributing
115
+
116
+ 1. Fork it ( https://github.com/rodrigoddalmeida/replication/fork )
117
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
118
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
119
+ 4. Push to the branch (`git push origin my-new-feature`)
120
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ task default: :test
5
+
6
+ desc 'Run unit tests.'
7
+ Rake::TestTask.new(:test) do |t|
8
+ t.libs << 'lib'
9
+ t.libs << 'test'
10
+ t.pattern = 'test/**/*_test.rb'
11
+ t.verbose = true
12
+ t.warning = false
13
+ end
@@ -0,0 +1,15 @@
1
+ class ReplicationMigration < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :strands do |t|
4
+ t.string :name
5
+ t.text :pairs
6
+ t.references :origin, polymorphic: true, index: true
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ drop_table :strands
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ require "orm_adapter/adapters/active_record"
2
+
3
+ module Replication
4
+ module ActiveRecord
5
+ class Strand < ::ActiveRecord::Base
6
+ extend Replication::StrandMethods
7
+ serialize :pairs
8
+ belongs_to :origin, polymorphic: true
9
+
10
+ validates :name, uniqueness: true, presence: true
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module Replication
2
+
3
+ class Config
4
+
5
+ attr_accessor :model_class, :pairs_method, :strand_class, :except
6
+
7
+ def initialize(model_class)
8
+ @model_class = model_class
9
+ end
10
+
11
+ def with(modules)
12
+ modules.each do |m|
13
+ model_class.send :extend, Replication::Modules.const_get(m.to_s.classify)
14
+ end
15
+ end
16
+
17
+ def set(options)
18
+ options and options.each {|name, value| self.send "#{name}=", value}
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ require 'rails/engine'
2
+ module Replication
3
+ class Engine < Rails::Engine
4
+ end
5
+ end
@@ -0,0 +1,27 @@
1
+ module Replication
2
+ module Modules
3
+ module Proofreading
4
+
5
+ def self.extended(model_class)
6
+ model_class.class_eval do
7
+ include Model
8
+ end
9
+ end
10
+
11
+ module Model
12
+
13
+ def unwound(**options)
14
+ super if valid?
15
+ end
16
+
17
+ def replicate(**options)
18
+ if valid?
19
+ super
20
+ else
21
+ raise Replication::UnwoundError, 'The origin must be valid!'
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,35 @@
1
+ module Replication
2
+ module Modules
3
+ module SemiConservative
4
+
5
+ def self.extended(model_class)
6
+ model_class.class_eval do
7
+ include Model
8
+ end
9
+ end
10
+
11
+ module Model
12
+
13
+ def unwound(**options)
14
+ strand_class.new({
15
+ name: options[:name],
16
+ pairs: strand_attributes,
17
+ origin: self
18
+ })
19
+ end
20
+
21
+ def replicate(**options)
22
+ strand_class.to_adapter.create!({
23
+ name: options[:name],
24
+ pairs: strand_attributes,
25
+ origin: self
26
+ })
27
+ end
28
+
29
+ def strand_attributes
30
+ _strand_attributes.except(*replication_config.except)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,57 @@
1
+ module Replication
2
+ module Process
3
+
4
+ def self.extended(model_class)
5
+ model_class.class_eval do
6
+ @@replication_config = Class.new(Config).new(self)
7
+ include Model
8
+ end
9
+ end
10
+
11
+ # Include or extend it. We work with both.
12
+ def self.included(model_class)
13
+ model_class.extend self
14
+ end
15
+
16
+ def can_replicate(pairs_method = :attributes, **options)
17
+ default_options = Replication.defaults
18
+ modules = [:semi_conservative] # required module
19
+ modules.concat(Array(options.delete(:with)))
20
+
21
+ @@replication_config.pairs_method = pairs_method
22
+ @@replication_config.set default_options.merge(options)
23
+ @@replication_config.with modules
24
+ end
25
+
26
+ def new_from_strand(id=nil, **options)
27
+ if id
28
+ strand = replication_config.strand_class.to_adapter.get!(id)
29
+ else
30
+ strand = replication_config.strand_class.to_adapter.find_first(options)
31
+ end
32
+
33
+ new(strand.pairs) if strand
34
+ end
35
+
36
+ def replication_config
37
+ @@replication_config
38
+ end
39
+
40
+ module Model
41
+
42
+ def strand_class
43
+ replication_config.strand_class
44
+ end
45
+
46
+ def replication_config
47
+ self.class.replication_config
48
+ end
49
+
50
+ private
51
+
52
+ def _strand_attributes
53
+ send(replication_config.pairs_method).deep_symbolize_keys
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,16 @@
1
+ module Replication
2
+ module StrandMethods
3
+
4
+ def self.extended(strand_class)
5
+ strand_class.class_eval do
6
+ include InstanceMethods
7
+ end
8
+ end
9
+
10
+ module InstanceMethods
11
+ def replicate
12
+ origin.new(pairs)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module Replication
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,27 @@
1
+ require "replication/version"
2
+
3
+ module Replication
4
+
5
+ autoload :Process, 'replication/process'
6
+ autoload :Config, 'replication/config'
7
+ autoload :StrandMethods, 'replication/strand_methods'
8
+
9
+ module ActiveRecord
10
+ autoload :Strand, 'replication/active_record/strand'
11
+ end
12
+
13
+ module Modules
14
+ autoload :SemiConservative, 'replication/modules/semi_conservative'
15
+ autoload :Proofreading, 'replication/modules/proofreading'
16
+ end
17
+
18
+ def self.defaults
19
+ defaults = {}
20
+ defaults.merge({
21
+ strand_class: ::Replication::ActiveRecord::Strand,
22
+ except: [:id, :created_at, :updated_at]
23
+ }) if defined?(ActiveRecord)
24
+ end
25
+
26
+ class UnwoundError < StandardError; end;
27
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'replication/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "replication"
8
+ spec.version = Replication::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.authors = ["Rodrigo DeAlmeida"]
11
+ spec.email = ["rodrigoddalmeida@gmail.com"]
12
+ spec.summary = %q{Data replication as templates for Ruby ORMs}
13
+ spec.description = %q{Data replication as templates for Ruby ORMs}
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,10 @@
1
+ ActiveRecord::Migration.verbose = false
2
+ ActiveRecord::Base.logger = Logger.new(nil)
3
+ ActiveRecord::Base.include_root_in_json = true
4
+
5
+ ActiveRecord::Migrator.migrate([File.expand_path("../../../db/migrate/", __FILE__), File.expand_path("../../rails_app/db/migrate/", __FILE__)])
6
+
7
+ class ActiveSupport::TestCase
8
+ self.use_transactional_fixtures = true
9
+ self.use_instantiated_fixtures = false
10
+ end
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ class Organism < ::ActiveRecord::Base
2
+ validates :name, presence: true
3
+ end
@@ -0,0 +1,34 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_model/railtie"
5
+ # require "action_controller/railtie"
6
+ # require "action_mailer/railtie"
7
+ # require "action_view/railtie"
8
+ # require "sprockets/railtie"
9
+ require "rails/test_unit/railtie"
10
+
11
+ Bundler.require :default, REPLICATION_ORM
12
+
13
+ begin
14
+ require "#{REPLICATION_ORM}/railtie"
15
+ rescue LoadError
16
+ end
17
+
18
+ require "replication"
19
+
20
+ module RailsApp
21
+ class Application < Rails::Application
22
+ # Settings in config/environments/* take precedence over those specified here.
23
+ # Application configuration should go into files in config/initializers
24
+ # -- all .rb files in that directory are automatically loaded.
25
+
26
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
27
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
28
+ # config.time_zone = 'Central Time (US & Canada)'
29
+
30
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
+ # config.i18n.default_locale = :de
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,22 @@
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
+ development:
8
+ adapter: sqlite3
9
+ database: db/development.sqlite3
10
+ pool: 5
11
+ timeout: 5000
12
+
13
+ # Warning: The database defined as "test" will be erased and
14
+ # re-generated from your development database when you run "rake".
15
+ # Do not set this db to the same as development or production.
16
+ test:
17
+ adapter: sqlite3
18
+ database: ":memory:"
19
+
20
+ production:
21
+ adapter: sqlite3
22
+ database: ":memory:"
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,37 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+
22
+ # Raise exceptions instead of rendering exception templates.
23
+ config.action_dispatch.show_exceptions = false
24
+
25
+ # Disable request forgery protection in test environment.
26
+
27
+ # Tell Action Mailer not to deliver emails to the real world.
28
+ # The :test delivery method accumulates sent emails in the
29
+ # ActionMailer::Base.deliveries array.
30
+ # config.action_mailer.delivery_method = :test
31
+
32
+ # Print deprecation notices to the stderr.
33
+ config.active_support.deprecation = :stderr
34
+
35
+ # Raises error for missing translations
36
+ # config.action_view.raise_on_missing_translations = true
37
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end