authlogic_bushido 0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. data/.gitignore +17 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +2 -0
  5. data/app/controllers/authlogic/cas/cas_authentication_controller.rb +7 -0
  6. data/app/controllers/authlogic/cas/cas_client_controller.rb +7 -0
  7. data/authlogic_bushido.gemspec +22 -0
  8. data/config/routes.rb +3 -0
  9. data/lib/authlogic_bushido.rb +1 -0
  10. data/lib/authlogic_cas/controller_actions/service.rb +72 -0
  11. data/lib/authlogic_cas/controller_actions/session.rb +32 -0
  12. data/lib/authlogic_cas/engine.rb +6 -0
  13. data/lib/authlogic_cas/rails_routes.rb +16 -0
  14. data/lib/authlogic_cas/single_sign_out/cache.rb +38 -0
  15. data/lib/authlogic_cas.rb +104 -0
  16. data/spec/authlogic_cas_spec.rb +150 -0
  17. data/spec/controllers/service_controller_spec.rb +51 -0
  18. data/spec/controllers/session_controller_spec.rb +31 -0
  19. data/spec/scenario/.gitignore +15 -0
  20. data/spec/scenario/Gemfile +5 -0
  21. data/spec/scenario/Rakefile +7 -0
  22. data/spec/scenario/app/assets/images/rails.png +0 -0
  23. data/spec/scenario/app/assets/javascripts/application.js +9 -0
  24. data/spec/scenario/app/assets/javascripts/main_controller.js.coffee +3 -0
  25. data/spec/scenario/app/assets/javascripts/user_sessions.js.coffee +3 -0
  26. data/spec/scenario/app/assets/javascripts/users.js.coffee +3 -0
  27. data/spec/scenario/app/assets/stylesheets/application.css +7 -0
  28. data/spec/scenario/app/assets/stylesheets/main_controller.css.scss +3 -0
  29. data/spec/scenario/app/assets/stylesheets/scaffolds.css.scss +56 -0
  30. data/spec/scenario/app/assets/stylesheets/user_sessions.css.scss +3 -0
  31. data/spec/scenario/app/assets/stylesheets/users.css.scss +3 -0
  32. data/spec/scenario/app/controllers/application_controller.rb +17 -0
  33. data/spec/scenario/app/controllers/main_controller.rb +8 -0
  34. data/spec/scenario/app/controllers/user_sessions_controller.rb +50 -0
  35. data/spec/scenario/app/controllers/users_controller.rb +86 -0
  36. data/spec/scenario/app/helpers/application_helper.rb +2 -0
  37. data/spec/scenario/app/helpers/main_controller_helper.rb +2 -0
  38. data/spec/scenario/app/helpers/user_sessions_helper.rb +2 -0
  39. data/spec/scenario/app/helpers/users_helper.rb +2 -0
  40. data/spec/scenario/app/mailers/.gitkeep +0 -0
  41. data/spec/scenario/app/models/.gitkeep +0 -0
  42. data/spec/scenario/app/models/user.rb +3 -0
  43. data/spec/scenario/app/models/user_session.rb +2 -0
  44. data/spec/scenario/app/views/layouts/application.html.erb +25 -0
  45. data/spec/scenario/app/views/main/another_cool_page.html.erb +3 -0
  46. data/spec/scenario/app/views/main/index.html.erb +2 -0
  47. data/spec/scenario/app/views/user_sessions/_form.html.erb +25 -0
  48. data/spec/scenario/app/views/user_sessions/edit.html.erb +3 -0
  49. data/spec/scenario/app/views/user_sessions/index.html.erb +25 -0
  50. data/spec/scenario/app/views/user_sessions/new.html.erb +5 -0
  51. data/spec/scenario/app/views/user_sessions/show.html.erb +15 -0
  52. data/spec/scenario/app/views/users/_form.html.erb +34 -0
  53. data/spec/scenario/app/views/users/edit.html.erb +6 -0
  54. data/spec/scenario/app/views/users/index.html.erb +27 -0
  55. data/spec/scenario/app/views/users/new.html.erb +5 -0
  56. data/spec/scenario/app/views/users/show.html.erb +20 -0
  57. data/spec/scenario/config/application.rb +54 -0
  58. data/spec/scenario/config/boot.rb +6 -0
  59. data/spec/scenario/config/environment.rb +17 -0
  60. data/spec/scenario/config/environments/development.rb +30 -0
  61. data/spec/scenario/config/environments/production.rb +60 -0
  62. data/spec/scenario/config/environments/test.rb +39 -0
  63. data/spec/scenario/config/initializers/authlogic_cas.rb +5 -0
  64. data/spec/scenario/config/initializers/backtrace_silencers.rb +7 -0
  65. data/spec/scenario/config/initializers/inflections.rb +10 -0
  66. data/spec/scenario/config/initializers/mime_types.rb +5 -0
  67. data/spec/scenario/config/initializers/secret_token.rb +7 -0
  68. data/spec/scenario/config/initializers/session_store.rb +8 -0
  69. data/spec/scenario/config/initializers/wrap_parameters.rb +14 -0
  70. data/spec/scenario/config/locales/en.yml +5 -0
  71. data/spec/scenario/config/routes.rb +16 -0
  72. data/spec/scenario/config.ru +4 -0
  73. data/spec/scenario/db/migrate/20120223141435_create_users.rb +17 -0
  74. data/spec/scenario/db/migrate/20120226154646_add_sessions_table.rb +16 -0
  75. data/spec/scenario/db/schema.rb +40 -0
  76. data/spec/scenario/db/seeds.rb +7 -0
  77. data/spec/scenario/script/rails +6 -0
  78. data/spec/single_sign_out/cache_spec.rb +47 -0
  79. data/spec/spec_helper.rb +22 -0
  80. metadata +243 -0
@@ -0,0 +1,56 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px; }
7
+
8
+ p, ol, ul, td {
9
+ font-family: verdana, arial, helvetica, sans-serif;
10
+ font-size: 13px;
11
+ line-height: 18px; }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px; }
17
+
18
+ a {
19
+ color: #000;
20
+ &:visited {
21
+ color: #666; }
22
+ &:hover {
23
+ color: #fff;
24
+ background-color: #000; } }
25
+
26
+ div {
27
+ &.field, &.actions {
28
+ margin-bottom: 10px; } }
29
+
30
+ #notice {
31
+ color: green; }
32
+
33
+ .field_with_errors {
34
+ padding: 2px;
35
+ background-color: red;
36
+ display: table; }
37
+
38
+ #error_explanation {
39
+ width: 450px;
40
+ border: 2px solid red;
41
+ padding: 7px;
42
+ padding-bottom: 0;
43
+ margin-bottom: 20px;
44
+ background-color: #f0f0f0;
45
+ h2 {
46
+ text-align: left;
47
+ font-weight: bold;
48
+ padding: 5px 5px 5px 15px;
49
+ font-size: 12px;
50
+ margin: -7px;
51
+ margin-bottom: 0px;
52
+ background-color: #c00;
53
+ color: #fff; }
54
+ ul li {
55
+ font-size: 12px;
56
+ list-style: square; } }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the user_sessions controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the Users controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,17 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+
4
+ helper_method :current_user
5
+
6
+ private
7
+
8
+ def current_user_session
9
+ return @current_user_session if defined?(@current_user_session)
10
+ @current_user_session = UserSession.find
11
+ end
12
+
13
+ def current_user
14
+ return @current_user if defined?(@current_user)
15
+ @current_user = current_user_session && current_user_session.record
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ class MainController < ApplicationController
2
+ def index
3
+ puts "CURRENT USER #{current_user.inspect}"
4
+ end
5
+
6
+ def another_cool_page
7
+ end
8
+ end
@@ -0,0 +1,50 @@
1
+ class UserSessionsController < ApplicationController
2
+
3
+ def new
4
+ puts "Trying new user session"
5
+ redirect_to(cas_login_url) unless returning_from_cas?
6
+ end
7
+
8
+
9
+ # POST /user_sessions
10
+ # POST /user_sessions.json
11
+ def create
12
+ @user_session = UserSession.new(params[:user_session])
13
+
14
+ respond_to do |format|
15
+ if @user_session.save
16
+ format.html { redirect_to root_path, notice: 'User session was successfully created.' }
17
+ format.json { render json: @user_session, status: :created, location: @user_session }
18
+ else
19
+ format.html { render action: "new" }
20
+ format.json { render json: @user_session.errors, status: :unprocessable_entity }
21
+ end
22
+ end
23
+ end
24
+
25
+
26
+ def destroy
27
+ @user_session = UserSession.find
28
+ @user_session.destroy
29
+
30
+ respond_to do |format|
31
+ format.html { redirect_to root_url }
32
+ format.json { head :ok }
33
+ end
34
+ end
35
+
36
+
37
+ protected
38
+ def returning_from_cas?
39
+ params[:ticket] || request.referer =~ /^#{::Authlogic::Cas.cas_client.cas_base_url}/
40
+ end
41
+
42
+
43
+ def cas_login_url
44
+ login_url = ::Authlogic::Cas.cas_client.add_service_to_login_url(users_service_url)
45
+ redirect_url = ""# "&redirect=#{cas_return_to_url}"
46
+ return "#{login_url}#{redirect_url}"
47
+ end
48
+ helper_method :cas_login_url
49
+
50
+ end
@@ -0,0 +1,86 @@
1
+ class UsersController < ApplicationController
2
+
3
+ ##########################################
4
+
5
+ # GET /users
6
+ # GET /users.json
7
+ def index
8
+ @users = User.all
9
+
10
+ respond_to do |format|
11
+ format.html # index.html.erb
12
+ format.json { render json: @users }
13
+ end
14
+ end
15
+
16
+ # GET /users/1
17
+ # GET /users/1.json
18
+ def show
19
+ @user = User.find(params[:id])
20
+
21
+ respond_to do |format|
22
+ format.html # show.html.erb
23
+ format.json { render json: @user }
24
+ end
25
+ end
26
+
27
+ # GET /users/new
28
+ # GET /users/new.json
29
+ def new
30
+ @user = User.new
31
+
32
+ respond_to do |format|
33
+ format.html # new.html.erb
34
+ format.json { render json: @user }
35
+ end
36
+ end
37
+
38
+ # GET /users/1/edit
39
+ def edit
40
+ @user = current_user
41
+ end
42
+
43
+ # POST /users
44
+ # POST /users.json
45
+ def create
46
+ @user = User.new(params[:user])
47
+
48
+ respond_to do |format|
49
+ if @user.save
50
+ format.html { redirect_to root_path, notice: 'Registration successful' }
51
+ format.json { render json: @user, status: :created, location: @user }
52
+ else
53
+ format.html { render action: "new" }
54
+ format.json { render json: @user.errors, status: :unprocessable_entity }
55
+ end
56
+ end
57
+ end
58
+
59
+ # PUT /users/1
60
+ # PUT /users/1.json
61
+ def update
62
+ @user = current_user
63
+
64
+ respond_to do |format|
65
+ if @user.update_attributes(params[:user])
66
+ format.html { redirect_to @user, notice: 'User was successfully updated.' }
67
+ format.json { head :ok }
68
+ else
69
+ format.html { render action: "edit" }
70
+ format.json { render json: @user.errors, status: :unprocessable_entity }
71
+ end
72
+ end
73
+ end
74
+
75
+ # DELETE /users/1
76
+ # DELETE /users/1.json
77
+ def destroy
78
+ @user = User.find(params[:id])
79
+ @user.destroy
80
+
81
+ respond_to do |format|
82
+ format.html { redirect_to users_url }
83
+ format.json { head :ok }
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module MainControllerHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UserSessionsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module UsersHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_authentic
3
+ end
@@ -0,0 +1,2 @@
1
+ class UserSession < Authlogic::Session::Base
2
+ end
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Altry</title>
5
+ <%= csrf_meta_tags %>
6
+ </head>
7
+ <body>
8
+ <div class="user_nav">
9
+
10
+ <%- if notice %>
11
+ <div id="notice"><%= notice %></div>
12
+ <%- end %>
13
+
14
+ <%- if current_user %>
15
+ <%= current_user.email %>
16
+ <%= link_to "Logout", logout_path, :method => :delete %>
17
+ <%- else %>
18
+ <%= link_to "Register", new_user_path %>
19
+ <%= link_to "Login", login_path %>
20
+ <%- end %>
21
+ </div>
22
+ <%= yield %>
23
+
24
+ </body>
25
+ </html>
@@ -0,0 +1,3 @@
1
+ <h2>
2
+ Hey dude this is another cool page!
3
+ </h2>
@@ -0,0 +1,2 @@
1
+ <h1>MainController#index</h1>
2
+ <p>Find me in app/views/main_controller/index.html.erb</p>
@@ -0,0 +1,25 @@
1
+ <%= form_for(@user_session) do |f| %>
2
+ <% if @user_session.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user_session.errors.count, "error") %> prohibited this user_session from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user_session.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :username %><br />
16
+ <%= f.text_field :username %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :password %><br />
20
+ <%= f.password_field :password %>
21
+ </div>
22
+ <div class="actions">
23
+ <%= f.submit %>
24
+ </div>
25
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h1>Editing user_session</h1>
2
+
3
+ <%= render 'form' %>
@@ -0,0 +1,25 @@
1
+ <h1>Listing user_sessions</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Username</th>
6
+ <th>Password</th>
7
+ <th></th>
8
+ <th></th>
9
+ <th></th>
10
+ </tr>
11
+
12
+ <% @user_sessions.each do |user_session| %>
13
+ <tr>
14
+ <td><%= user_session.username %></td>
15
+ <td><%= user_session.password %></td>
16
+ <td><%= link_to 'Show', user_session %></td>
17
+ <td><%= link_to 'Edit', edit_user_session_path(user_session) %></td>
18
+ <td><%= link_to 'Destroy', user_session, confirm: 'Are you sure?', method: :delete %></td>
19
+ </tr>
20
+ <% end %>
21
+ </table>
22
+
23
+ <br />
24
+
25
+ <%= link_to 'New User session', new_user_session_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New user_session</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', user_sessions_path %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Username:</b>
5
+ <%= @user_session.username %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Password:</b>
10
+ <%= @user_session.password %>
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_user_session_path(@user_session) %> |
15
+ <%= link_to 'Back', user_sessions_path %>
@@ -0,0 +1,34 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :email %><br />
16
+ <%= f.text_field :email %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= f.label :username %><br />
21
+ <%= f.text_field :username %>
22
+ </div>
23
+ <div class="field">
24
+ <%= f.label :password %><br />
25
+ <%= f.password_field :password %>
26
+ </div>
27
+ <div class="field">
28
+ <%= f.label :password_confirmation %><br />
29
+ <%= f.password_field :password_confirmation %>
30
+ </div>
31
+ <div class="actions">
32
+ <%= f.submit %>
33
+ </div>
34
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,27 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Email</th>
6
+ <th>Password</th>
7
+ <th>Username</th>
8
+ <th></th>
9
+ <th></th>
10
+ <th></th>
11
+ </tr>
12
+
13
+ <% @users.each do |user| %>
14
+ <tr>
15
+ <td><%= user.email %></td>
16
+ <td><%= user.password %></td>
17
+ <td><%= user.username %></td>
18
+ <td><%= link_to 'Show', user %></td>
19
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
20
+ <td><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %></td>
21
+ </tr>
22
+ <% end %>
23
+ </table>
24
+
25
+ <br />
26
+
27
+ <%= link_to 'New User', new_user_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,20 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Email:</b>
5
+ <%= @user.email %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Password:</b>
10
+ <%= @user.password %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Username:</b>
15
+ <%= @user.username %>
16
+ </p>
17
+
18
+
19
+ <%= link_to 'Edit', edit_user_path(@user) %> |
20
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,54 @@
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
+ if defined?(Bundler)
12
+ # If you precompile assets before deploying to production, use this line
13
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
14
+ # If you want your assets lazily compiled in production, use this line
15
+ # Bundler.require(:default, :assets, Rails.env)
16
+ end
17
+
18
+ module Altry
19
+ class Application < Rails::Application
20
+ # Settings in config/environments/* take precedence over those specified here.
21
+ # Application configuration should go into files in config/initializers
22
+ # -- all .rb files in that directory are automatically loaded.
23
+
24
+ # Custom directories with classes and modules you want to be autoloadable.
25
+ # config.autoload_paths += %W(#{config.root}/extras)
26
+
27
+ # Only load the plugins named here, in the order given (default is alphabetical).
28
+ # :all can be used as a placeholder for all plugins not explicitly named.
29
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
30
+
31
+ # Activate observers that should always be running.
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
36
+ # config.time_zone = 'Central Time (US & Canada)'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
40
+ # config.i18n.default_locale = :de
41
+
42
+ # Configure the default encoding used in templates for Ruby 1.9.
43
+ config.encoding = "utf-8"
44
+
45
+ # Configure sensitive parameters which will be filtered from the log file.
46
+ config.filter_parameters += [:password]
47
+
48
+ # Enable the asset pipeline
49
+ config.assets.enabled = true
50
+
51
+ # Version of your assets, change this if you want to expire all your assets
52
+ config.assets.version = '1.0'
53
+ end
54
+ end
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,17 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Altry::Application.initialize!
6
+
7
+ def in_memory_database?
8
+ ENV["RAILS_ENV"] == "test" and
9
+ ActiveRecord::Base.connection.class == ActiveRecord::ConnectionAdapters::SQLiteAdapter and
10
+ Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
11
+ end
12
+
13
+ if in_memory_database?
14
+ puts "creating sqlite in memory database"
15
+ load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
16
+ # ActiveRecord::Migrator.up('db/migrate') # use migrations
17
+ end
@@ -0,0 +1,30 @@
1
+ Altry::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
@@ -0,0 +1,60 @@
1
+ Altry::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
+ # Full error reports are disabled and caching is turned on
8
+ config.consider_all_requests_local = false
9
+ config.action_controller.perform_caching = true
10
+
11
+ # Disable Rails's static asset server (Apache or nginx will already do this)
12
+ config.serve_static_assets = false
13
+
14
+ # Compress JavaScripts and CSS
15
+ config.assets.compress = true
16
+
17
+ # Don't fallback to assets pipeline if a precompiled asset is missed
18
+ config.assets.compile = false
19
+
20
+ # Generate digests for assets URLs
21
+ config.assets.digest = true
22
+
23
+ # Defaults to Rails.root.join("public/assets")
24
+ # config.assets.manifest = YOUR_PATH
25
+
26
+ # Specifies the header that your server uses for sending files
27
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
+
30
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
+ # config.force_ssl = true
32
+
33
+ # See everything in the log (default is :info)
34
+ # config.log_level = :debug
35
+
36
+ # Use a different logger for distributed setups
37
+ # config.logger = SyslogLogger.new
38
+
39
+ # Use a different cache store in production
40
+ # config.cache_store = :mem_cache_store
41
+
42
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
+ # config.action_controller.asset_host = "http://assets.example.com"
44
+
45
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
+ # config.assets.precompile += %w( search.js )
47
+
48
+ # Disable delivery errors, bad email addresses will be ignored
49
+ # config.action_mailer.raise_delivery_errors = false
50
+
51
+ # Enable threaded mode
52
+ # config.threadsafe!
53
+
54
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
+ # the I18n.default_locale when a translation can not be found)
56
+ config.i18n.fallbacks = true
57
+
58
+ # Send deprecation notices to registered listeners
59
+ config.active_support.deprecation = :notify
60
+ end