gdatastore_mapper 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/README.md +29 -2
- data/lib/gdatastore_mapper/associations.rb +9 -0
- data/lib/gdatastore_mapper/persistence.rb +27 -2
- data/lib/gdatastore_mapper/relation.rb +5 -0
- data/lib/gdatastore_mapper/scoping.rb +0 -1
- data/lib/gdatastore_mapper/version.rb +1 -1
- data/rails_example/.gitignore +17 -0
- data/rails_example/Gemfile +33 -0
- data/rails_example/Gemfile.lock +327 -0
- data/rails_example/README.md +24 -0
- data/rails_example/Rakefile +6 -0
- data/rails_example/app/assets/config/manifest.js +3 -0
- data/rails_example/app/assets/images/.keep +0 -0
- data/rails_example/app/assets/javascripts/application.js +16 -0
- data/rails_example/app/assets/javascripts/authors.coffee +3 -0
- data/rails_example/app/assets/javascripts/cable.js +13 -0
- data/rails_example/app/assets/javascripts/channels/.keep +0 -0
- data/rails_example/app/assets/stylesheets/application.css +15 -0
- data/rails_example/app/assets/stylesheets/authors.scss +3 -0
- data/rails_example/app/controllers/application_controller.rb +3 -0
- data/rails_example/app/controllers/authors_controller.rb +49 -0
- data/rails_example/app/controllers/books_controller.rb +60 -0
- data/rails_example/app/controllers/concerns/.keep +0 -0
- data/rails_example/app/models/author.rb +15 -0
- data/rails_example/app/models/book.rb +9 -0
- data/rails_example/app/views/authors/_form.html.erb +17 -0
- data/rails_example/app/views/authors/edit.html.erb +1 -0
- data/rails_example/app/views/authors/index.html.erb +22 -0
- data/rails_example/app/views/authors/new.html.erb +1 -0
- data/rails_example/app/views/books/_form.html.erb +21 -0
- data/rails_example/app/views/books/_update_form.html.erb +21 -0
- data/rails_example/app/views/books/edit.html.erb +1 -0
- data/rails_example/app/views/books/index.html.erb +45 -0
- data/rails_example/app/views/books/new.html.erb +1 -0
- data/rails_example/app/views/books/show.html.erb +29 -0
- data/rails_example/app/views/layouts/application.html.erb +28 -0
- data/rails_example/bin/bundle +3 -0
- data/rails_example/bin/rails +9 -0
- data/rails_example/bin/rake +9 -0
- data/rails_example/bin/setup +34 -0
- data/rails_example/bin/spring +17 -0
- data/rails_example/bin/update +29 -0
- data/rails_example/config/application.rb +25 -0
- data/rails_example/config/boot.rb +3 -0
- data/rails_example/config/cable.yml +9 -0
- data/rails_example/config/database.yml +8 -0
- data/rails_example/config/environment.rb +5 -0
- data/rails_example/config/environments/development.rb +51 -0
- data/rails_example/config/environments/production.rb +83 -0
- data/rails_example/config/environments/test.rb +42 -0
- data/rails_example/config/initializers/application_controller_renderer.rb +6 -0
- data/rails_example/config/initializers/assets.rb +11 -0
- data/rails_example/config/initializers/backtrace_silencers.rb +7 -0
- data/rails_example/config/initializers/cookies_serializer.rb +5 -0
- data/rails_example/config/initializers/filter_parameter_logging.rb +4 -0
- data/rails_example/config/initializers/inflections.rb +16 -0
- data/rails_example/config/initializers/mime_types.rb +4 -0
- data/rails_example/config/initializers/new_framework_defaults.rb +21 -0
- data/rails_example/config/initializers/session_store.rb +3 -0
- data/rails_example/config/initializers/wrap_parameters.rb +9 -0
- data/rails_example/config/locales/en.yml +23 -0
- data/rails_example/config/puma.rb +47 -0
- data/rails_example/config/routes.rb +7 -0
- data/rails_example/config/secrets.yml +22 -0
- data/rails_example/config/spring.rb +6 -0
- data/rails_example/config.ru +5 -0
- data/rails_example/db/seeds.rb +7 -0
- data/rails_example/lib/assets/.keep +0 -0
- data/rails_example/lib/tasks/.keep +0 -0
- data/rails_example/public/404.html +67 -0
- data/rails_example/public/422.html +67 -0
- data/rails_example/public/500.html +66 -0
- data/rails_example/public/apple-touch-icon-precomposed.png +0 -0
- data/rails_example/public/apple-touch-icon.png +0 -0
- data/rails_example/public/favicon.ico +0 -0
- data/rails_example/public/robots.txt +5 -0
- metadata +72 -2
@@ -0,0 +1,49 @@
|
|
1
|
+
class AuthorsController < ApplicationController
|
2
|
+
def index
|
3
|
+
@authors = Author.order(created_at: :desc)
|
4
|
+
end
|
5
|
+
|
6
|
+
def new
|
7
|
+
@author = Author.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def edit
|
11
|
+
@author = Author.find params[:id]
|
12
|
+
end
|
13
|
+
|
14
|
+
def update
|
15
|
+
@author = Author.find params[:id]
|
16
|
+
|
17
|
+
if @author.update author_params
|
18
|
+
flash[:success] = "Updated author"
|
19
|
+
redirect_to author_books_path(@author)
|
20
|
+
else
|
21
|
+
render :edit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def destroy
|
26
|
+
@author = Author.find params[:id]
|
27
|
+
@author.delete_books
|
28
|
+
@author.destroy
|
29
|
+
redirect_to authors_path
|
30
|
+
end
|
31
|
+
|
32
|
+
def create
|
33
|
+
@author = Author.new author_params
|
34
|
+
|
35
|
+
if @author.save
|
36
|
+
flash[:success] = "Added author"
|
37
|
+
redirect_to author_books_path(@author)
|
38
|
+
else
|
39
|
+
render :new
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def author_params
|
46
|
+
params.require(:author).permit(:name)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
class BooksController < ApplicationController
|
2
|
+
before_action :set_author, only: [:index, :new, :create]
|
3
|
+
before_action :set_book, only: [:show, :edit, :update, :destroy]
|
4
|
+
|
5
|
+
def index
|
6
|
+
@books = @author.books
|
7
|
+
end
|
8
|
+
|
9
|
+
def new
|
10
|
+
@book = Book.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def show
|
14
|
+
end
|
15
|
+
|
16
|
+
def edit
|
17
|
+
@author = @book.author
|
18
|
+
end
|
19
|
+
|
20
|
+
def update
|
21
|
+
if @book.update book_params
|
22
|
+
flash[:success] = "Updated book"
|
23
|
+
redirect_to book_path(@book)
|
24
|
+
else
|
25
|
+
render :edit
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def destroy
|
30
|
+
@author = @book.author
|
31
|
+
@book.destroy
|
32
|
+
redirect_to author_books_path(@author)
|
33
|
+
end
|
34
|
+
|
35
|
+
def create
|
36
|
+
@book = @author.books.new book_params
|
37
|
+
|
38
|
+
if @book.save
|
39
|
+
flash[:success] = "Added book"
|
40
|
+
redirect_to book_path(@book)
|
41
|
+
else
|
42
|
+
render :new
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def set_author
|
49
|
+
@author = Author.find params[:author_id]
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_book
|
53
|
+
@book = Book.find params[:id]
|
54
|
+
end
|
55
|
+
|
56
|
+
def book_params
|
57
|
+
params.require(:book).permit(:title, :description)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h3>Author</h3>
|
2
|
+
|
3
|
+
<% if @author.errors.any? %>
|
4
|
+
<div class="errors">
|
5
|
+
<% @author.errors.full_messages.each do |message| %>
|
6
|
+
<div class="alert alert-danger"><%= message %></div>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= form_for @author do |f| %>
|
12
|
+
<div class="form-group">
|
13
|
+
<%= f.label :name %>
|
14
|
+
<%= f.text_field :name %>
|
15
|
+
</div>
|
16
|
+
<button class="btn btn-success" type="submit">Save</button>
|
17
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: "form" %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h3>Authors</h3>
|
2
|
+
|
3
|
+
<%= link_to new_author_path, class: "btn btn-success btn-sm" do %>
|
4
|
+
<i class="glyphicon glyphicon-plus"></i>
|
5
|
+
<span>Add author</span>
|
6
|
+
<% end %>
|
7
|
+
<p>
|
8
|
+
<% @authors.each do |author| %>
|
9
|
+
|
10
|
+
<div class="panel panel-default">
|
11
|
+
<div class="panel-body">
|
12
|
+
<%= link_to author_books_path(author) do %>
|
13
|
+
<h3 class="panel-title"><%= author.name %></h3>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<% if @authors.none? %>
|
21
|
+
<p>No authors found.</p>
|
22
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: "form" %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h3><%= @author.name %>'s Book</h3>
|
2
|
+
|
3
|
+
<% if @book.errors.any? %>
|
4
|
+
<div class="errors">
|
5
|
+
<% @book.errors.full_messages.each do |message| %>
|
6
|
+
<div class="alert alert-danger"><%= message %></div>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= form_for @book, url: author_books_path(@author) do |f| %>
|
12
|
+
<div class="form-group">
|
13
|
+
<%= f.label :title %>
|
14
|
+
<%= f.text_field :title %>
|
15
|
+
</div>
|
16
|
+
<div class="form-group">
|
17
|
+
<%= f.label :description %>
|
18
|
+
<%= f.text_area :description %>
|
19
|
+
</div>
|
20
|
+
<button class="btn btn-success" type="submit">Save</button>
|
21
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h3><%= @author.name %>'s Book</h3>
|
2
|
+
|
3
|
+
<% if @book.errors.any? %>
|
4
|
+
<div class="errors">
|
5
|
+
<% @book.errors.full_messages.each do |message| %>
|
6
|
+
<div class="alert alert-danger"><%= message %></div>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= form_for @book, url: book_path(@book) do |f| %>
|
12
|
+
<div class="form-group">
|
13
|
+
<%= f.label :title %>
|
14
|
+
<%= f.text_field :title %>
|
15
|
+
</div>
|
16
|
+
<div class="form-group">
|
17
|
+
<%= f.label :description %>
|
18
|
+
<%= f.text_area :description %>
|
19
|
+
</div>
|
20
|
+
<button class="btn btn-success" type="submit">Save</button>
|
21
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: "update_form" %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<h3><%= @author.name %></h3>
|
2
|
+
|
3
|
+
<div class="media">
|
4
|
+
<div class="media-body">
|
5
|
+
<p> id :
|
6
|
+
<%= @author.id %></p>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="btn-group">
|
11
|
+
<%= link_to edit_author_path(@author), class: "btn btn-primary btn-sm" do %>
|
12
|
+
<i class="glyphicon glyphicon-edit"></i>
|
13
|
+
<span>Edit Author</span>
|
14
|
+
<% end %>
|
15
|
+
<%= link_to author_path(@author), class: "btn btn-danger btn-sm", method: :delete do %>
|
16
|
+
<i class="glyphicon glyphicon-trash"></i>
|
17
|
+
<span>Delete Author</span>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<h3><%= @author.name %>'s Books</h3>
|
22
|
+
|
23
|
+
|
24
|
+
<% @books.each do |book| %>
|
25
|
+
|
26
|
+
<div class="panel panel-default">
|
27
|
+
<div class="panel-body">
|
28
|
+
<%= link_to book_path(book) do %>
|
29
|
+
<h3 class="panel-title"><%= book.title %></h3>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% if @books.none? %>
|
37
|
+
<p>No books found.</p>
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<%= link_to new_author_book_path, class: "btn btn-success btn-sm" do %>
|
41
|
+
<i class="glyphicon glyphicon-plus"></i>
|
42
|
+
<span>Add <%= @author.name %>'s Book</span>
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
<p>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: "form" %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h3>Book</h3>
|
2
|
+
|
3
|
+
<div class="btn-group">
|
4
|
+
<%= link_to edit_book_path(@book), class: "btn btn-primary btn-sm" do %>
|
5
|
+
<i class="glyphicon glyphicon-edit"></i>
|
6
|
+
<span>Edit Book</span>
|
7
|
+
<% end %>
|
8
|
+
<%= link_to book_path(@book), class: "btn btn-danger btn-sm", method: :delete do %>
|
9
|
+
<i class="glyphicon glyphicon-trash"></i>
|
10
|
+
<span>Delete Book</span>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="media">
|
15
|
+
<div class="media-body">
|
16
|
+
<h4><%= @book.title %></h4>
|
17
|
+
<h5>By
|
18
|
+
<%= link_to author_books_path(@book.author) do %>
|
19
|
+
<%= @book.author.name || "unknown" %></h5>
|
20
|
+
<% end %>
|
21
|
+
<p><%= @book.description %></p>
|
22
|
+
<p> created at :
|
23
|
+
<%= @book.created_at %></p>
|
24
|
+
<p> updated at :
|
25
|
+
<%= @book.updated_at %></p>
|
26
|
+
<p> id :
|
27
|
+
<%= @book.id %></p>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Gdatastore Mapper - RailsExample</title>
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewset" content="width=device-width, initial-scale=1">
|
7
|
+
<%= stylesheet_link_tag "//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" %>
|
8
|
+
<%= javascript_include_tag "application" %>
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div class="navbar navbar-default">
|
13
|
+
<div class="container">
|
14
|
+
<div class="navbar-header">
|
15
|
+
<div class="navbar-brand"><a href="/">Gdatastore Mapper Rails example</a></div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<div class="container">
|
20
|
+
<% if flash.any? %>
|
21
|
+
<% flash.each do |type, message| %>
|
22
|
+
<div class="alert alert-<%= type %>"><%= message %></div>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
<%= yield %>
|
26
|
+
</div>
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
begin
|
3
|
+
load File.expand_path('../spring', __FILE__)
|
4
|
+
rescue LoadError => e
|
5
|
+
raise unless e.message.include?('spring')
|
6
|
+
end
|
7
|
+
APP_PATH = File.expand_path('../config/application', __dir__)
|
8
|
+
require_relative '../config/boot'
|
9
|
+
require 'rails/commands'
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# This file loads spring without using Bundler, in order to be fast.
|
4
|
+
# It gets overwritten when you run the `spring binstub` command.
|
5
|
+
|
6
|
+
unless defined?(Spring)
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler'
|
9
|
+
|
10
|
+
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
|
11
|
+
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
|
12
|
+
if spring
|
13
|
+
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
14
|
+
gem 'spring', spring.version
|
15
|
+
require 'spring/binstub'
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
require "rails"
|
4
|
+
# Pick the frameworks you want:
|
5
|
+
require "active_model/railtie"
|
6
|
+
require "active_job/railtie"
|
7
|
+
# require "active_record/railtie"
|
8
|
+
require "action_controller/railtie"
|
9
|
+
require "action_mailer/railtie"
|
10
|
+
require "action_view/railtie"
|
11
|
+
require "action_cable/engine"
|
12
|
+
require "sprockets/railtie"
|
13
|
+
require "rails/test_unit/railtie"
|
14
|
+
|
15
|
+
# Require the gems listed in Gemfile, including any gems
|
16
|
+
# you've limited to :test, :development, or :production.
|
17
|
+
Bundler.require(*Rails.groups)
|
18
|
+
|
19
|
+
module RailsExample
|
20
|
+
class Application < Rails::Application
|
21
|
+
# Settings in config/environments/* take precedence over those specified here.
|
22
|
+
# Application configuration should go into files in config/initializers
|
23
|
+
# -- all .rb files in that directory are automatically loaded.
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
config.cache_store = :memory_store
|
20
|
+
config.public_file_server.headers = {
|
21
|
+
'Cache-Control' => 'public, max-age=172800'
|
22
|
+
}
|
23
|
+
else
|
24
|
+
config.action_controller.perform_caching = false
|
25
|
+
|
26
|
+
config.cache_store = :null_store
|
27
|
+
end
|
28
|
+
|
29
|
+
# Don't care if the mailer can't send.
|
30
|
+
config.action_mailer.raise_delivery_errors = false
|
31
|
+
|
32
|
+
config.action_mailer.perform_caching = false
|
33
|
+
|
34
|
+
# Print deprecation notices to the Rails logger.
|
35
|
+
config.active_support.deprecation = :log
|
36
|
+
|
37
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
38
|
+
# This option may cause significant delays in view rendering with a large
|
39
|
+
# number of complex assets.
|
40
|
+
config.assets.debug = true
|
41
|
+
|
42
|
+
# Suppress logger output for asset requests.
|
43
|
+
config.assets.quiet = true
|
44
|
+
|
45
|
+
# Raises error for missing translations
|
46
|
+
# config.action_view.raise_on_missing_translations = true
|
47
|
+
|
48
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
49
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
50
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
51
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
Rails.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 threaded 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
|
+
# Disable serving static files from the `/public` folder by default since
|
18
|
+
# Apache or NGINX already handles this.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
20
|
+
|
21
|
+
# Compress JavaScripts and CSS.
|
22
|
+
config.assets.js_compressor = :uglifier
|
23
|
+
# config.assets.css_compressor = :sass
|
24
|
+
|
25
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
26
|
+
config.assets.compile = false
|
27
|
+
|
28
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
29
|
+
|
30
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
+
|
33
|
+
# Specifies the header that your server uses for sending files.
|
34
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
35
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
36
|
+
|
37
|
+
# Mount Action Cable outside main process or domain
|
38
|
+
# config.action_cable.mount_path = nil
|
39
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
40
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
46
|
+
# when problems arise.
|
47
|
+
config.log_level = :debug
|
48
|
+
|
49
|
+
# Prepend all log lines with the following tags.
|
50
|
+
config.log_tags = [ :request_id ]
|
51
|
+
|
52
|
+
# Use a different cache store in production.
|
53
|
+
# config.cache_store = :mem_cache_store
|
54
|
+
|
55
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
56
|
+
# config.active_job.queue_adapter = :resque
|
57
|
+
# config.active_job.queue_name_prefix = "rails_example_#{Rails.env}"
|
58
|
+
config.action_mailer.perform_caching = false
|
59
|
+
|
60
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
61
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
62
|
+
# config.action_mailer.raise_delivery_errors = false
|
63
|
+
|
64
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
65
|
+
# the I18n.default_locale when a translation cannot be found).
|
66
|
+
config.i18n.fallbacks = true
|
67
|
+
|
68
|
+
# Send deprecation notices to registered listeners.
|
69
|
+
config.active_support.deprecation = :notify
|
70
|
+
|
71
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
72
|
+
config.log_formatter = ::Logger::Formatter.new
|
73
|
+
|
74
|
+
# Use a different logger for distributed setups.
|
75
|
+
# require 'syslog/logger'
|
76
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
77
|
+
|
78
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
79
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
80
|
+
logger.formatter = config.log_formatter
|
81
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
82
|
+
end
|
83
|
+
end
|