stackable_flash 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +19 -0
- data/.travis.yml +8 -0
- data/CHANGELOG +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +80 -0
- data/Rakefile +29 -0
- data/lib/stackable_flash/config.rb +38 -0
- data/lib/stackable_flash/flash_stack.rb +37 -0
- data/lib/stackable_flash/stack_layer.rb +47 -0
- data/lib/stackable_flash/version.rb +3 -0
- data/lib/stackable_flash.rb +64 -0
- data/spec/controllers/dummy_controller_spec.rb +23 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/dummy_controller.rb +14 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/dummy/override.html.erb +3 -0
- data/spec/dummy/app/views/dummy/stack.html.erb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +62 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +34 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/stackable_flash/flash_stack_spec.rb +116 -0
- data/stackable_flash.gemspec +26 -0
- metadata +213 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Peter Boling
|
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,80 @@
|
|
1
|
+
stackable_flash
|
2
|
+
===============
|
3
|
+
|
4
|
+
Stackable Flash overrides the :[]= method of Rails' FlashHash to make it work like Array's :<< method instead, and makes each flash key an array.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'stackable_flash'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install stackable_flash
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
When turned on all flashes can be interacted with as arrays.
|
23
|
+
|
24
|
+
flash[:notice] = 'First message' # Will have the same affect that pushing it onto an array would
|
25
|
+
flash[:notice] << 'Second message' # No need to initialize first, or test to see if responds to :<<
|
26
|
+
flash[:notice] |= 'Third message' # Will add this message only if unique in the stack
|
27
|
+
flash[:notice] += ['Fourth','Fifth'] # Will add all of the messages onto the stack individually.
|
28
|
+
|
29
|
+
flash[:notice] # is now: ['First message','Second message','Third message','Fourth','Fifth']
|
30
|
+
|
31
|
+
But StackableFlash preserves existing functionality for code you already have written.
|
32
|
+
|
33
|
+
flash[:notice] += ' Appended' # Will append a message to the top/last message on the stack.
|
34
|
+
|
35
|
+
flash[:notice] # is now: ['First message','Second message','Third message','Fourth','Fifth Appended']
|
36
|
+
|
37
|
+
flash[:notice] = 'Overwrite'
|
38
|
+
|
39
|
+
flash[:notice] # is now: ['Overwrite']
|
40
|
+
|
41
|
+
It is on by default. To turn it off:
|
42
|
+
|
43
|
+
StackableFlash.stacked = false
|
44
|
+
|
45
|
+
To turn it back on:
|
46
|
+
|
47
|
+
StackableFlash.stacked = true
|
48
|
+
|
49
|
+
You can even start out with it off set a flash, turn it on, and add to the stack:
|
50
|
+
|
51
|
+
StackableFlash.stacked = false
|
52
|
+
flash[:notice] = 'string'
|
53
|
+
StackableFlash.stacked = true
|
54
|
+
flash[:notice] << 'string'
|
55
|
+
|
56
|
+
There are block helpers which I am sure some enterprising individual will have a use for:
|
57
|
+
|
58
|
+
StackableFlash.stacked({:stack_with_proc => Proc.new {|arr| arr.map! {|x| "<p>#{x}</p>"}.join } } ) do
|
59
|
+
flash[:notice] = 'original'
|
60
|
+
flash[:notice] << 'message'
|
61
|
+
flash[:notice] # => ['original','message']
|
62
|
+
flash[:notice].stack # => '<p>original</p><p>message</p>'
|
63
|
+
end
|
64
|
+
|
65
|
+
And
|
66
|
+
|
67
|
+
StackableFlash.not_stacked do
|
68
|
+
flash[:notice] = 'original'
|
69
|
+
flash[:notice] << ' message'
|
70
|
+
flash[:notice] # => 'original message'
|
71
|
+
flash[:notice].stack # => NoMethodError !!!
|
72
|
+
end
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
1. Fork it
|
77
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
78
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
79
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
80
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
require 'rspec/core'
|
7
|
+
require 'rspec/core/rake_task'
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
9
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'reek/rake/task'
|
13
|
+
Reek::Rake::Task.new do |t|
|
14
|
+
t.fail_on_error = true
|
15
|
+
t.verbose = false
|
16
|
+
t.source_files = 'lib/**/*.rb'
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'roodi'
|
20
|
+
require 'roodi_task'
|
21
|
+
RoodiTask.new do |t|
|
22
|
+
t.verbose = false
|
23
|
+
end
|
24
|
+
|
25
|
+
task :default => :spec
|
26
|
+
|
27
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
28
|
+
|
29
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module StackableFlash
|
2
|
+
class Config
|
3
|
+
|
4
|
+
class << self
|
5
|
+
attr_accessor :config
|
6
|
+
end
|
7
|
+
|
8
|
+
DEFAULTS = {
|
9
|
+
# Specify how stacked flashes at the same key (e.g. :notice, :errors) should be returned:
|
10
|
+
#
|
11
|
+
# Example:
|
12
|
+
# flash[:notice] = 'Message 1'
|
13
|
+
# flash[:notice] << 'Message 2'
|
14
|
+
#
|
15
|
+
# the flash[:notice] object now looks like when :stack_with_proc => lambda { |arr| arr }:
|
16
|
+
#
|
17
|
+
# flash[:notice] # => ['Message 1','Message 2']
|
18
|
+
#
|
19
|
+
# the flash[:notice] object now looks like when :stack_with_proc => lambda { |arr| arr.join('<br/>') }:
|
20
|
+
#
|
21
|
+
# flash[:notice] # => "Message 1<br/>Message 2"
|
22
|
+
#
|
23
|
+
# The default leaves the flash as a string of all the flashes joined by br tags,
|
24
|
+
# to preserve compatibility with existing javascript, and/or views
|
25
|
+
# that expect the flashes as a single string.
|
26
|
+
:stack_with_proc => Proc.new { |arr| arr.join('<br/>') }
|
27
|
+
}
|
28
|
+
|
29
|
+
#cattr_reader :config
|
30
|
+
#cattr_writer :config
|
31
|
+
|
32
|
+
self.config ||= DEFAULTS
|
33
|
+
def self.configure &block
|
34
|
+
yield @@config
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module StackableFlash
|
2
|
+
class FlashStack < Array
|
3
|
+
|
4
|
+
# Handle the following use case:
|
5
|
+
# flash[:notice] = 'First Part'
|
6
|
+
# flash[:notice] += ' Second Part'
|
7
|
+
# => ['First Part Second Part']
|
8
|
+
define_method "+_with_stacking", lambda {|to_add|
|
9
|
+
if StackableFlash.stacking
|
10
|
+
if to_add.kind_of?(Array)
|
11
|
+
self.send("+_without_stacking", to_add)
|
12
|
+
else
|
13
|
+
# Make sure it responds to +, otherwise just push it onto the stack
|
14
|
+
if self.last.respond_to?(:+)
|
15
|
+
self[self.length -1] = self.last + to_add
|
16
|
+
else
|
17
|
+
self << to_add
|
18
|
+
end
|
19
|
+
end
|
20
|
+
else
|
21
|
+
self.send("+_without_stacking", to_add)
|
22
|
+
end
|
23
|
+
}
|
24
|
+
alias_method_chain :+, :stacking
|
25
|
+
|
26
|
+
def stack
|
27
|
+
if StackableFlash.stacking
|
28
|
+
# Format the stacked flashes according to stack_with_proc lambda
|
29
|
+
StackableFlash::Config.config[:stack_with_proc].call(self)
|
30
|
+
else
|
31
|
+
# All StackableFlash functionality is completely bypassed
|
32
|
+
self
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require "stackable_flash/flash_stack"
|
2
|
+
|
3
|
+
module StackableFlash
|
4
|
+
module StackLayer
|
5
|
+
def self.included(base)
|
6
|
+
base.send(:alias_method_chain, "[]=", "stacking")
|
7
|
+
end
|
8
|
+
|
9
|
+
define_method "[]_with_stacking=" do |key, value|
|
10
|
+
if StackableFlash.stacking
|
11
|
+
# Do it in a non-stacking block so we get normal behavior from flash[:notice] calls
|
12
|
+
StackableFlash.not_stacked do
|
13
|
+
# Make an array at the key, while providing a seamless upgrade to existing flashes
|
14
|
+
#
|
15
|
+
# Initial set to Array
|
16
|
+
#
|
17
|
+
# Principle of least surprise
|
18
|
+
# flash[:notice] = ['message1','message2']
|
19
|
+
# flash[:notice] # => ['message1','message2']
|
20
|
+
#
|
21
|
+
# Initial set to String
|
22
|
+
#
|
23
|
+
# Principle of least surprise
|
24
|
+
# flash[:notice] = 'original'
|
25
|
+
# flash[:notice] # => ['original']
|
26
|
+
#
|
27
|
+
# Overwrite!
|
28
|
+
#
|
29
|
+
# Principle of least surprise
|
30
|
+
# flash[:notice] = 'original'
|
31
|
+
# flash[:notice] = 'altered'
|
32
|
+
# flash[:notice] # => ['altered']
|
33
|
+
#
|
34
|
+
# The same line of code does all of the above:
|
35
|
+
self[key] = StackableFlash::FlashStack.new.replace(value.kind_of?(Array) ? value : Array(value))
|
36
|
+
|
37
|
+
# Leave existing behavior in place, but send the full array as the value so it doesn't get killed.
|
38
|
+
send("[]_without_stacking=", key, self[key])
|
39
|
+
end
|
40
|
+
else
|
41
|
+
# All StackableFlash functionality is completely bypassed
|
42
|
+
send("[]_without_stacking=", key, value)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "stackable_flash/version"
|
2
|
+
require "stackable_flash/config"
|
3
|
+
require "stackable_flash/flash_stack"
|
4
|
+
require "stackable_flash/stack_layer"
|
5
|
+
|
6
|
+
module StackableFlash
|
7
|
+
class << self
|
8
|
+
attr_accessor :stacking
|
9
|
+
end
|
10
|
+
self.stacking = true # Turn on stacking by default
|
11
|
+
|
12
|
+
# Regardless of the value of StackableFlash.stacking you can do a local override to force stacking.
|
13
|
+
#
|
14
|
+
# StackableFlash.stacked do
|
15
|
+
# flash[:notice] = 'a simple string' # Use flash as if this gem did not exist
|
16
|
+
# flash[:notice] = 'another' # will stack the strings
|
17
|
+
# flash[:notice] # => ['a simple string','another'],
|
18
|
+
# # but returned as "a simple string<br/>another" with default config
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
def self.stacked(config_options = {}, &block)
|
22
|
+
flashing({:forcing => true}) do
|
23
|
+
original = StackableFlash::Config.config.dup
|
24
|
+
StackableFlash::Config.config.merge!(config_options)
|
25
|
+
yield
|
26
|
+
StackableFlash::Config.config = original
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Regardless of the value of StackableFlash.stacking you can do a local override to force non-stacking.
|
31
|
+
#
|
32
|
+
# StackableFlash.not_stacked do
|
33
|
+
# flash[:notice] = 'a simple string' # Use flash as if this gem did not exist
|
34
|
+
# flash[:notice] = '' # will overwrite the string above
|
35
|
+
# flash[:notice] # => ''
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
def self.not_stacked &block
|
39
|
+
flashing({:forcing => false}) do
|
40
|
+
yield
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.flashing(options, &block)
|
45
|
+
return false unless block_given?
|
46
|
+
original = StackableFlash.stacking
|
47
|
+
StackableFlash.stacking = options[:forcing]
|
48
|
+
yield
|
49
|
+
StackableFlash.stacking = original
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
require 'action_pack/version'
|
55
|
+
base = begin
|
56
|
+
if ActionPack::VERSION::MAJOR >= 3
|
57
|
+
require 'action_dispatch'
|
58
|
+
ActionDispatch::Flash::FlashHash
|
59
|
+
else
|
60
|
+
require 'action_controller'
|
61
|
+
ActionController::Flash::FlashHash
|
62
|
+
end
|
63
|
+
end
|
64
|
+
base.send :include, StackableFlash::StackLayer
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DummyController do
|
4
|
+
|
5
|
+
render_views
|
6
|
+
|
7
|
+
it "should override" do
|
8
|
+
get :override
|
9
|
+
controller.flash[:notice].should == ['message']
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should build a stack" do
|
13
|
+
get :stack
|
14
|
+
controller.flash[:notice].should == ['original','message','another']
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should allow transformation" do
|
18
|
+
get :stack
|
19
|
+
controller.flash[:notice].stack.should == 'original<br/>message<br/>another'
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,15 @@
|
|
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
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= 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
|
+
class DummyController < ApplicationController
|
2
|
+
include StackableFlash
|
3
|
+
def override
|
4
|
+
flash[:notice] = 'original'
|
5
|
+
flash[:notice] = 'message'
|
6
|
+
end
|
7
|
+
|
8
|
+
def stack
|
9
|
+
flash[:notice] = 'original'
|
10
|
+
flash[:notice] << 'message'
|
11
|
+
flash[:notice] << 'another'
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
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" %>
|
6
|
+
<%= javascript_include_tag "application", :stackable_flash %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
#require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
#require "action_mailer/railtie"
|
7
|
+
#require "active_resource/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
# require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require
|
12
|
+
require "stackable_flash"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
config.filter_parameters += [:password]
|
43
|
+
|
44
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
45
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
46
|
+
# like if you have constraints or database-specific column types
|
47
|
+
# config.active_record.schema_format = :sql
|
48
|
+
|
49
|
+
# Enforce whitelist mode for mass assignment.
|
50
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
51
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
52
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
53
|
+
# config.active_record.whitelist_attributes = true
|
54
|
+
|
55
|
+
# Enable the asset pipeline
|
56
|
+
config.assets.enabled = true
|
57
|
+
|
58
|
+
# Version of your assets, change this if you want to expire all your assets
|
59
|
+
config.assets.version = '1.0'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -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
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,30 @@
|
|
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
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
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
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Do not compress assets
|
26
|
+
config.assets.compress = false
|
27
|
+
|
28
|
+
# Expands the lines which load the assets
|
29
|
+
config.assets.debug = true
|
30
|
+
end
|