edgarj 0.01.12
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 +23 -0
- data/Rakefile +40 -0
- data/app/assets/javascripts/edgarj/base.js +49 -0
- data/app/assets/javascripts/edgarj/menu.js +39 -0
- data/app/assets/javascripts/edgarj/operator_selection.js +133 -0
- data/app/assets/stylesheets/edgarj/base.css +304 -0
- data/app/assets/stylesheets/edgarj/menu.css +65 -0
- data/app/controllers/edgarj/authentication_mixin.rb.sample +30 -0
- data/app/controllers/edgarj/controller_mixin_common.rb +80 -0
- data/app/controllers/edgarj/controller_mixin_for_app.rb +71 -0
- data/app/controllers/edgarj/edgarj_controller.rb +535 -0
- data/app/controllers/edgarj/model_permissions_controller.rb +8 -0
- data/app/controllers/edgarj/permission_mixin.rb +84 -0
- data/app/controllers/edgarj/popup_controller.rb +128 -0
- data/app/controllers/edgarj/rescue_mixin.rb +37 -0
- data/app/controllers/edgarj/user_group_users_controller.rb +8 -0
- data/app/controllers/edgarj/user_groups_controller.rb +9 -0
- data/app/controllers/edgarj/user_groups_popup_controller.rb +8 -0
- data/app/helpers/edgarj/assoc_helper.rb +369 -0
- data/app/helpers/edgarj/common_helper.rb +37 -0
- data/app/helpers/edgarj/edgarj_helper.rb +20 -0
- data/app/helpers/edgarj/field_helper.rb +397 -0
- data/app/helpers/edgarj/form_drawer.rb +322 -0
- data/app/helpers/edgarj/list_drawer.rb +169 -0
- data/app/helpers/edgarj/menu_helper.rb +92 -0
- data/app/helpers/edgarj/model_permissions_helper.rb +9 -0
- data/app/helpers/edgarj/popup_helper.rb +40 -0
- data/app/helpers/edgarj/search_helper.rb +14 -0
- data/app/helpers/edgarj/sessions_helper.rb +9 -0
- data/app/helpers/edgarj/user_group_users_helper.rb +9 -0
- data/app/helpers/edgarj/user_groups_helper.rb +9 -0
- data/app/helpers/edgarj/user_groups_popup_helper.rb +9 -0
- data/app/models/edgarj/drawer/base.rb +234 -0
- data/app/models/edgarj/drawer/normal.rb +6 -0
- data/app/models/edgarj/drawer/popup.rb +47 -0
- data/app/models/edgarj/drawer.rb +13 -0
- data/app/models/edgarj/model_permission.rb +41 -0
- data/app/models/edgarj/page_info.rb +47 -0
- data/app/models/edgarj/search.rb +81 -0
- data/app/models/edgarj/search_form.rb +255 -0
- data/app/models/edgarj/search_popup.rb +44 -0
- data/app/models/edgarj/sssn.rb +120 -0
- data/app/models/edgarj/user_group.rb +67 -0
- data/app/models/edgarj/user_group_user.rb +18 -0
- data/app/models/edgarj.rb +5 -0
- data/app/views/edgarj/edgarj/_form.html.erb +25 -0
- data/app/views/edgarj/edgarj/_list.html.erb +52 -0
- data/app/views/edgarj/edgarj/_message_popup.html.erb +15 -0
- data/app/views/edgarj/edgarj/_search_form.html.erb +64 -0
- data/app/views/edgarj/edgarj/_search_operator.html.erb +17 -0
- data/app/views/edgarj/edgarj/_search_operator_selection.html.erb +12 -0
- data/app/views/edgarj/edgarj/clear.js.erb +1 -0
- data/app/views/edgarj/edgarj/create.js.erb +4 -0
- data/app/views/edgarj/edgarj/destroy.js.erb +2 -0
- data/app/views/edgarj/edgarj/index.html.erb +37 -0
- data/app/views/edgarj/edgarj/index.js.erb +1 -0
- data/app/views/edgarj/edgarj/message_popup.js.erb +3 -0
- data/app/views/edgarj/edgarj/page_info_save.js.erb +1 -0
- data/app/views/edgarj/edgarj/search.js.erb +4 -0
- data/app/views/edgarj/edgarj/search_clear.js.erb +1 -0
- data/app/views/edgarj/edgarj/show.js.erb +1 -0
- data/app/views/edgarj/edgarj/top.html.erb +4 -0
- data/app/views/edgarj/edgarj/update.js.erb +4 -0
- data/app/views/edgarj/popup/_index.html.erb +16 -0
- data/app/views/edgarj/popup/_list.html.erb +42 -0
- data/app/views/edgarj/popup/_message_popup.html.erb +15 -0
- data/app/views/edgarj/popup/_search.html.erb +42 -0
- data/app/views/edgarj/popup/_search_save_popup.html.erb +16 -0
- data/app/views/edgarj/popup/index.js.erb +5 -0
- data/app/views/edgarj/popup/message_popup.js.erb +3 -0
- data/app/views/edgarj/popup/page_info_save.js.erb +1 -0
- data/app/views/edgarj/popup/search.js.erb +15 -0
- data/app/views/edgarj/popup/view_status_save.js.erb +1 -0
- data/config/routes.rb +15 -0
- data/config/settings.yml +5 -0
- data/db/migrate/20131118084600_create_edgar_sssns.rb +14 -0
- data/db/migrate/20131123124730_create_edgar_page_infos.rb +15 -0
- data/db/migrate/20140116062252_create_edgar_user_groups.rb +18 -0
- data/db/migrate/20140116062327_create_edgar_user_group_users.rb +10 -0
- data/db/migrate/20140206222308_create_edgar_model_permissions.rb +14 -0
- data/db/migrate/20141209053055_rename_edgar_to_edgarj.rb +17 -0
- data/lib/core_ext/active_record.rb +123 -0
- data/lib/core_ext/resources.rb +71 -0
- data/lib/edgarj/engine.rb +64 -0
- data/lib/edgarj/enum_cache.rb +46 -0
- data/lib/edgarj/templates/rails/helper/helper.rb +10 -0
- data/lib/edgarj/templates/test_unit/scaffold/functional_test.rb +575 -0
- data/lib/edgarj/version.rb +3 -0
- data/lib/edgarj.rb +14 -0
- data/lib/generators/edgarj/popup_scaffold/USAGE +6 -0
- data/lib/generators/edgarj/popup_scaffold/popup_scaffold_generator.rb +35 -0
- data/lib/generators/edgarj/popup_scaffold/templates/controller.rb +13 -0
- data/lib/generators/edgarj/popup_scaffold/templates/functional_test.rb +197 -0
- data/lib/generators/edgarj/popup_scaffold/templates/helper.rb +9 -0
- data/lib/generators/edgarj/scaffold/USAGE +17 -0
- data/lib/generators/edgarj/scaffold/scaffold_generator.rb +40 -0
- data/lib/generators/edgarj/scaffold/templates/controller.rb +13 -0
- data/lib/tasks/edgarj_tasks.rake +32 -0
- data/lib/tasks/pakcage.rake +18 -0
- data/locale/en.yml +94 -0
- data/locale/ja.yml +100 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +21 -0
- data/test/dummy/app/assets/javascripts/authors.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +16 -0
- data/test/dummy/app/assets/stylesheets/authors.css +4 -0
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +15 -0
- data/test/dummy/app/controllers/authors_controller.rb +6 -0
- data/test/dummy/app/controllers/authors_popup_controller.rb +6 -0
- data/test/dummy/app/controllers/books_controller.rb +6 -0
- data/test/dummy/app/controllers/dummy_auth_mixin.rb +36 -0
- data/test/dummy/app/decorators/models/edgarj/user_group_decorator.rb +1 -0
- data/test/dummy/app/helpers/application_helper.rb +3 -0
- data/test/dummy/app/helpers/authors_helper.rb +7 -0
- data/test/dummy/app/helpers/authors_popup_helper.rb +7 -0
- data/test/dummy/app/helpers/books_helper.rb +7 -0
- data/test/dummy/app/models/author.rb +32 -0
- data/test/dummy/app/models/book.rb +5 -0
- data/test/dummy/app/models/user.rb +13 -0
- data/test/dummy/app/views/layouts/application.html.erb +32 -0
- data/test/dummy/app/views/layouts/login.html.erb +20 -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 +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +15 -0
- data/test/dummy/config/edgarj/menu_config.rb +28 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +42 -0
- data/test/dummy/config/environments/production.rb +79 -0
- data/test/dummy/config/environments/test.rb +34 -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/strong_parameter.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +26 -0
- data/test/dummy/config/routes.rb +60 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/migrate/20131107120635_create_authors.rb +9 -0
- data/test/dummy/db/migrate/20131218011851_create_books.rb +10 -0
- data/test/dummy/db/migrate/20140201000000_add_user_group_id_to_authors.rb +5 -0
- data/test/dummy/db/migrate/20140807065420_create_users.rb +10 -0
- data/test/dummy/db/schema.rb +93 -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/dummy/script/rails +6 -0
- data/test/dummy/test/functional/authors_controller_test.rb +631 -0
- data/test/dummy/test/functional/books_controller_test.rb +516 -0
- data/test/dummy/test/helpers/authors_helper_test.rb +4 -0
- data/test/dummy/test/unit/author_test.rb +7 -0
- data/test/dummy/test/unit/book_test.rb +7 -0
- data/test/edgar_test.rb +7 -0
- data/test/fixtures/authors.yml +32 -0
- data/test/fixtures/books.yml +56 -0
- data/test/fixtures/edgarj/model_permissions.yml +97 -0
- data/test/fixtures/edgarj/page_infos.yml +84 -0
- data/test/fixtures/edgarj/sssns.yml +38 -0
- data/test/fixtures/edgarj/user_group_users.yml +114 -0
- data/test/fixtures/edgarj/user_groups.yml +95 -0
- data/test/fixtures/users.yml +49 -0
- data/test/functional/edgarj/edgarj_controller_test.rb +24 -0
- data/test/functional/edgarj/model_permissions_controller_test.rb +554 -0
- data/test/functional/edgarj/user_group_users_controller_test.rb +567 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/support/edgarj/controller_supporter.rb +23 -0
- data/test/test_helper.rb +23 -0
- data/test/unit/edgarj/model_permission_test.rb +27 -0
- data/test/unit/edgarj/page_info_test.rb +7 -0
- data/test/unit/edgarj/sssn_test.rb +10 -0
- data/test/unit/edgarj/user_group_test.rb +32 -0
- data/test/unit/edgarj/user_group_user_test.rb +9 -0
- data/test/unit/helpers/edgarj/model_permissions_helper_test.rb +6 -0
- data/test/unit/helpers/edgarj/user_group_users_helper_test.rb +6 -0
- metadata +456 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
include Edgarj::ControllerMixinForApp
|
3
|
+
include DummyAuthMixin
|
4
|
+
include Edgarj::RescueMixin
|
5
|
+
|
6
|
+
# Prevent CSRF attacks by raising an exception.
|
7
|
+
# For APIs, you may want to use :null_session instead.
|
8
|
+
protect_from_forgery with: :exception
|
9
|
+
|
10
|
+
# order is important. *Latter* should be more specific.
|
11
|
+
rescue_from StandardError, with: :edgarj_rescue_app_error
|
12
|
+
rescue_from ActiveRecord::RecordNotFound, with: :edgarj_rescue_404
|
13
|
+
|
14
|
+
before_filter :require_login
|
15
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Authentication Module just for Test
|
2
|
+
#
|
3
|
+
# Since user is in outside app of Edgarj, authentication module at controller
|
4
|
+
# should also provided by the app.
|
5
|
+
#
|
6
|
+
# Application should provide:
|
7
|
+
# * current_user
|
8
|
+
# * this should be alos helper method
|
9
|
+
#
|
10
|
+
# NOTE: require_login is not mandatory, but required for just test.
|
11
|
+
module DummyAuthMixin
|
12
|
+
def self.included(klass)
|
13
|
+
klass.helper_method :current_user
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def access_denied
|
19
|
+
flash.now[:error] = v('login_failed')
|
20
|
+
render text: nil, response: 400
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_user
|
24
|
+
@current_user ||=
|
25
|
+
if Rails.env == 'development'
|
26
|
+
User.find_by_code('root')
|
27
|
+
else
|
28
|
+
User.find(session[:user_id]) if session[:user_id]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# before_filter to enforce a login requirement.
|
33
|
+
def require_login
|
34
|
+
!!current_user || access_denied
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Edgarj::UserGroup::Kind.const_set(:AUTHOR_ASSIGNEE, 10000)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Author < ActiveRecord::Base
|
2
|
+
belongs_to :user_group, class_name: Edgarj::UserGroup
|
3
|
+
has_many :books
|
4
|
+
|
5
|
+
validates_presence_of :name
|
6
|
+
|
7
|
+
# declare 'has_many :authors' at Edgarj::UserGroup here
|
8
|
+
Edgarj::UserGroup.has_many :authors
|
9
|
+
|
10
|
+
# 1. admin and author_reader can access all of authors
|
11
|
+
# 1. The user, who belongs to AUTHOR_ASSIGNEE user_group, can access
|
12
|
+
# the authors belongs to the user_group.
|
13
|
+
# 1. otherwise, cannot
|
14
|
+
scope :user_scoped, lambda{|user, context, id_target|
|
15
|
+
if user.admin? ||
|
16
|
+
user.user_groups.where('kind=? AND name in (?)',
|
17
|
+
Edgarj::UserGroup::Kind::ROLE,
|
18
|
+
['author/reader', 'author/admin']).count > 0
|
19
|
+
where('1=1')
|
20
|
+
else
|
21
|
+
joins(user_group: :user_group_users).
|
22
|
+
where(
|
23
|
+
'edgarj_user_groups.kind' => Edgarj::UserGroup::Kind::AUTHOR_ASSIGNEE,
|
24
|
+
'edgarj_user_group_users.user_id' => user.id)
|
25
|
+
end
|
26
|
+
}
|
27
|
+
|
28
|
+
def initialize(attrs = {})
|
29
|
+
super
|
30
|
+
#self.adrs = Edgarj::Address.new if self.adrs == nil
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class User < ActiveRecord::Base
|
2
|
+
attr_accessible :code, :name
|
3
|
+
|
4
|
+
has_many :user_group_users, dependent: :destroy, class_name: 'Edgarj::UserGroupUser'
|
5
|
+
has_many :user_groups, through: :user_group_users, class_name: 'Edgarj::UserGroup'
|
6
|
+
has_many :sssns, dependent: :destroy, class_name: 'Edgarj::Sssn'
|
7
|
+
|
8
|
+
def admin?
|
9
|
+
user_groups.where(
|
10
|
+
kind: Edgarj::UserGroup::Kind::ROLE,
|
11
|
+
name: 'admin').count > 0
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<table width='100%' class=edgarj_header>
|
11
|
+
<tr>
|
12
|
+
<td>
|
13
|
+
<%= draw_menu %>
|
14
|
+
</td>
|
15
|
+
<td>
|
16
|
+
<% flash.each do |name, msg| %>
|
17
|
+
<%= content_tag :span, msg, :id => "flash_#{name}" %>
|
18
|
+
<% end %>
|
19
|
+
</td>
|
20
|
+
<td align=right class=user>
|
21
|
+
Login: <%= current_user.name || '' %>
|
22
|
+
</td>
|
23
|
+
</tr>
|
24
|
+
</table>
|
25
|
+
<div class="clear"> </div>
|
26
|
+
|
27
|
+
<br clear=all />
|
28
|
+
|
29
|
+
<%= yield %>
|
30
|
+
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body class='edgarj_login'>
|
10
|
+
|
11
|
+
<% flash.each do |name, msg| %>
|
12
|
+
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<br clear=all />
|
16
|
+
|
17
|
+
<%= yield %>
|
18
|
+
|
19
|
+
</body>
|
20
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "edgarj"
|
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
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
15
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
16
|
+
|
17
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
18
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
19
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
20
|
+
|
21
|
+
# Activate observers that should always be running.
|
22
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
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
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
33
|
+
config.encoding = "utf-8"
|
34
|
+
|
35
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
36
|
+
config.filter_parameters += [:password]
|
37
|
+
|
38
|
+
# Enable escaping HTML in JSON.
|
39
|
+
config.active_support.escape_html_entities_in_json = true
|
40
|
+
|
41
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
42
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
43
|
+
# like if you have constraints or database-specific column types
|
44
|
+
# config.active_record.schema_format = :sql
|
45
|
+
|
46
|
+
# Enforce whitelist mode for mass assignment.
|
47
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
48
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
49
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
50
|
+
config.active_record.whitelist_attributes = false
|
51
|
+
|
52
|
+
# Enable the asset pipeline
|
53
|
+
config.assets.enabled = true
|
54
|
+
|
55
|
+
# Version of your assets, change this if you want to expire all your assets
|
56
|
+
config.assets.version = '1.0'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Edgarj::MenuConfig
|
2
|
+
def top
|
3
|
+
[
|
4
|
+
# kind menu name
|
5
|
+
[:controller, :App, Rails.application.routes, [
|
6
|
+
# controller names
|
7
|
+
'authors',
|
8
|
+
'books',
|
9
|
+
'_separator', # special entry for separator
|
10
|
+
#'edgarj/users',
|
11
|
+
#'edgarj/user_groups',
|
12
|
+
#'edgarj/user_group_users',
|
13
|
+
#'edgarj/model_permissions',
|
14
|
+
#'edgarj/sssns',
|
15
|
+
'_separator',
|
16
|
+
#'edgarj/addresses',
|
17
|
+
#'edgarj/zip_addresses',
|
18
|
+
]],
|
19
|
+
|
20
|
+
# TODO: '/logout' doesn't work on URL prefix.
|
21
|
+
# 'logout' generates wrong logout URL on edgarj/* pages.
|
22
|
+
#
|
23
|
+
# kind link_to args
|
24
|
+
[:item, ['logout', 'logout', {method: :delete}]]
|
25
|
+
]
|
26
|
+
end
|
27
|
+
module_function :top
|
28
|
+
end
|
@@ -0,0 +1,42 @@
|
|
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
|
+
# Raise an error on page load if there are skip migrations
|
23
|
+
#config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Only use best-standards-support built into browsers
|
26
|
+
config.action_dispatch.best_standards_support = :builtin
|
27
|
+
|
28
|
+
# Raise exception on mass assignment protection for Active Record models
|
29
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
30
|
+
|
31
|
+
# Log the query plan for queries taking more than this (works
|
32
|
+
# with SQLite, MySQL, and PostgreSQL)
|
33
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
34
|
+
|
35
|
+
# Do not compress assets
|
36
|
+
config.assets.compress = false
|
37
|
+
|
38
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
39
|
+
# This option may cause significant delays in view rendering with a large
|
40
|
+
# number of complex assets.
|
41
|
+
config.assets.debug = true
|
42
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.compress = true
|
27
|
+
|
28
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
29
|
+
config.assets.compile = false
|
30
|
+
|
31
|
+
# Generate digests for assets URLs.
|
32
|
+
config.assets.digest = true
|
33
|
+
|
34
|
+
# Version of your assets, change this if you want to expire all your assets.
|
35
|
+
config.assets.version = '1.0'
|
36
|
+
|
37
|
+
# Specifies the header that your server uses for sending files.
|
38
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
39
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
40
|
+
|
41
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
42
|
+
# config.force_ssl = true
|
43
|
+
|
44
|
+
# Set to :debug to see everything in the log.
|
45
|
+
config.log_level = :info
|
46
|
+
|
47
|
+
# Prepend all log lines with the following tags.
|
48
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
49
|
+
|
50
|
+
# Use a different logger for distributed setups.
|
51
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
52
|
+
|
53
|
+
# Use a different cache store in production.
|
54
|
+
# config.cache_store = :mem_cache_store
|
55
|
+
|
56
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
57
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
58
|
+
|
59
|
+
# Precompile additional assets.
|
60
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
61
|
+
# config.assets.precompile += %w( search.js )
|
62
|
+
|
63
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
64
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
65
|
+
# config.action_mailer.raise_delivery_errors = false
|
66
|
+
|
67
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
68
|
+
# the I18n.default_locale when a translation can not be found).
|
69
|
+
config.i18n.fallbacks = true
|
70
|
+
|
71
|
+
# Send deprecation notices to registered listeners.
|
72
|
+
config.active_support.deprecation = :notify
|
73
|
+
|
74
|
+
# Disable automatic flushing of the log to improve performance.
|
75
|
+
# config.autoflush_log = false
|
76
|
+
|
77
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
78
|
+
config.log_formatter = ::Logger::Formatter.new
|
79
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Dummy::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
|
+
# Log error messages when you accidentally call methods on nil
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
14
|
+
config.serve_static_assets = true
|
15
|
+
config.static_cache_control = "public, max-age=3600"
|
16
|
+
|
17
|
+
# Show full error reports and disable caching.
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates.
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment.
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
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
|
+
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,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,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '69d8c06082d600e6f942350d3a8043538435384f4b6a2e6ae633ac037be4fd83dde1b52d709d42e360f6d95b04594ee6e9a33a148b3f04e184a76652fa1a5435'
|
@@ -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
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
24
|
+
view:
|
25
|
+
authors:
|
26
|
+
test_word: 'Test Word!'
|