8 | <% end %>
9 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
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'
10 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
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 | require_relative '../config/boot'
8 | require 'rake'
9 | Rake.application.run
10 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a starting point to setup your application.
14 | # Add necessary setup steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies if using Yarn
21 | # system('bin/yarn')
22 |
23 | # puts "\n== Copying sample files =="
24 | # unless File.exist?('config/database.yml')
25 | # cp 'config/database.yml.sample', 'config/database.yml'
26 | # end
27 |
28 | puts "\n== Preparing database =="
29 | system! 'bin/rails db:setup'
30 |
31 | puts "\n== Removing old logs and tempfiles =="
32 | system! 'bin/rails log:clear tmp:clear'
33 |
34 | puts "\n== Restarting application server =="
35 | system! 'bin/rails restart'
36 | end
37 |
--------------------------------------------------------------------------------
/bin/spring:
--------------------------------------------------------------------------------
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
18 |
--------------------------------------------------------------------------------
/bin/update:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'fileutils'
3 | include FileUtils
4 |
5 | # path to your application root.
6 | APP_ROOT = File.expand_path('..', __dir__)
7 |
8 | def system!(*args)
9 | system(*args) || abort("\n== Command #{args} failed ==")
10 | end
11 |
12 | chdir APP_ROOT do
13 | # This script is a way to update your development environment automatically.
14 | # Add necessary update steps to this file.
15 |
16 | puts '== Installing dependencies =='
17 | system! 'gem install bundler --conservative'
18 | system('bundle check') || system!('bundle install')
19 |
20 | # Install JavaScript dependencies if using Yarn
21 | # system('bin/yarn')
22 |
23 | puts "\n== Updating database =="
24 | system! 'bin/rails db:migrate'
25 |
26 | puts "\n== Removing old logs and tempfiles =="
27 | system! 'bin/rails log:clear tmp:clear'
28 |
29 | puts "\n== Restarting application server =="
30 | system! 'bin/rails restart'
31 | end
32 |
--------------------------------------------------------------------------------
/bin/webpack:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4 | ENV["NODE_ENV"] ||= "development"
5 |
6 | require "pathname"
7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8 | Pathname.new(__FILE__).realpath)
9 |
10 | require "rubygems"
11 | require "bundler/setup"
12 |
13 | require "webpacker"
14 | require "webpacker/webpack_runner"
15 | Webpacker::WebpackRunner.run(ARGV)
16 |
--------------------------------------------------------------------------------
/bin/webpack-dev-server:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development"
4 | ENV["NODE_ENV"] ||= "development"
5 |
6 | require "pathname"
7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
8 | Pathname.new(__FILE__).realpath)
9 |
10 | require "rubygems"
11 | require "bundler/setup"
12 |
13 | require "webpacker"
14 | require "webpacker/dev_server_runner"
15 | Webpacker::DevServerRunner.run(ARGV)
16 |
--------------------------------------------------------------------------------
/bin/yarn:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_ROOT = File.expand_path('..', __dir__)
3 | Dir.chdir(APP_ROOT) do
4 | begin
5 | exec "yarnpkg", *ARGV
6 | rescue Errno::ENOENT
7 | $stderr.puts "Yarn executable was not detected in the system."
8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9 | exit 1
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative 'config/environment'
4 |
5 | run Rails.application
6 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative 'boot'
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module NestedForms
10 | class Application < Rails::Application
11 | # Expose our application's helpers to Administrate
12 | config.to_prepare do
13 | Administrate::ApplicationController.helper NestedForms::Application.helpers
14 | end
15 | config.active_job.queue_adapter = :sidekiq
16 | config.application_name = Rails.application.class.parent_name
17 | # Initialize configuration defaults for originally generated Rails version.
18 | config.load_defaults 5.2
19 |
20 | # Settings in config/environments/* take precedence over those specified here.
21 | # Application configuration can go into files in config/initializers
22 | # -- all .rb files in that directory are automatically loaded after loading
23 | # the framework and any gems in your application.
24 | end
25 | end
26 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
5 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: redis
3 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
4 | channel_prefix: streaming_logs_dev
5 |
6 | test:
7 | adapter: async
8 |
9 | production:
10 | adapter: redis
11 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
12 | channel_prefix: streaming_logs_production
13 |
14 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | OvN3/WriQUAj1pMzFJ0IvKcCE5WQf9SRUXL37seXgbqMTX7A4IWssl764ljVqN2zr6i6KDesJcE7Xkd7lhoU2/lOopyiE8NdI03DwNB8EDaJ/RYB5MAJBsDcjO/CRejKvCwwA2Oidl/By28xnz6dAckGy1PtI4aQmhWa1kodvCEoQtZSikcRiQ6B2hSMlqgDOMsNjQgJZYoYD9GEnY9LQGIo3aue/X47Fg2H41E+2Apwg4zBBlfd9f0+h+YWV/FcpsNr5BNgFdpJzKJhZZDIKdt8krY/5bqQUjLXCNMbxanEPiBDHQsdCBwI9qE5NqCkw2pGt3qYOo/R1V0fKT2azkK07YYwpC1uiQwIpzBPXvtz/DF+L98cZMieQYWonlMyoi+RPoc88MKJ6nHNgsKXjuXHKTe53V32IObk--xCsHi9Tuatzhk008--QK9UyTb+aVy9NMOrYfMKCg==
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.1 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On OS X with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On OS X with MacPorts:
8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9 | # On Windows:
10 | # gem install pg
11 | # Choose the win32 build.
12 | # Install PostgreSQL and put its /bin directory on your path.
13 | #
14 | # Configure Using Gemfile
15 | # gem 'pg'
16 | #
17 | default: &default
18 | adapter: postgresql
19 | encoding: unicode
20 | # For details on connection pooling, see Rails configuration guide
21 | # http://guides.rubyonrails.org/configuring.html#database-pooling
22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23 |
24 | development:
25 | <<: *default
26 | database: nested_forms_development
27 |
28 | # The specified database role being used to connect to postgres.
29 | # To create additional roles in postgres see `$ createuser --help`.
30 | # When left blank, postgres will use the default role. This is
31 | # the same name as the operating system user that initialized the database.
32 | #username: nested_forms
33 |
34 | # The password associated with the postgres role (username).
35 | #password:
36 |
37 | # Connect on a TCP socket. Omitted by default since the client uses a
38 | # domain socket that doesn't need configuration. Windows does not have
39 | # domain sockets, so uncomment these lines.
40 | #host: localhost
41 |
42 | # The TCP port the server listens on. Defaults to 5432.
43 | # If your server runs on a different port number, change accordingly.
44 | #port: 5432
45 |
46 | # Schema search path. The server defaults to $user,public
47 | #schema_search_path: myapp,sharedapp,public
48 |
49 | # Minimum log levels, in increasing order:
50 | # debug5, debug4, debug3, debug2, debug1,
51 | # log, notice, warning, error, fatal, and panic
52 | # Defaults to warning.
53 | #min_messages: notice
54 |
55 | # Warning: The database defined as "test" will be erased and
56 | # re-generated from your development database when you run "rake".
57 | # Do not set this db to the same as development or production.
58 | test:
59 | <<: *default
60 | database: nested_forms_test
61 |
62 | # As with config/secrets.yml, you never want to store sensitive information,
63 | # like your database password, in your source code. If your source code is
64 | # ever seen by anyone, they now have access to your database.
65 | #
66 | # Instead, provide the password as a unix environment variable when you boot
67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
68 | # for a full rundown on how to provide these environment variables in a
69 | # production deployment.
70 | #
71 | # On Heroku and other platform providers, you may have a full connection URL
72 | # available as an environment variable. For example:
73 | #
74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75 | #
76 | # You can use this database configuration with:
77 | #
78 | # production:
79 | # url: <%= ENV['DATABASE_URL'] %>
80 | #
81 | production:
82 | <<: *default
83 | database: nested_forms_production
84 | username: nested_forms
85 | password: <%= ENV['NESTED_FORMS_DATABASE_PASSWORD'] %>
86 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative 'application'
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | config.webpacker.check_yarn_integrity = true
4 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
5 | # Settings specified here will take precedence over those in config/application.rb.
6 |
7 | # In the development environment your application's code is reloaded on
8 | # every request. This slows down response time but is perfect for development
9 | # since you don't have to restart the web server when you make code changes.
10 | config.cache_classes = false
11 |
12 | # Do not eager load code on boot.
13 | config.eager_load = false
14 |
15 | # Show full error reports.
16 | config.consider_all_requests_local = true
17 |
18 | # Enable/disable caching. By default caching is disabled.
19 | # Run rails dev:cache to toggle caching.
20 | if Rails.root.join('tmp', 'caching-dev.txt').exist?
21 | config.action_controller.perform_caching = true
22 |
23 | config.cache_store = :memory_store
24 | config.public_file_server.headers = {
25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}"
26 | }
27 | else
28 | config.action_controller.perform_caching = false
29 |
30 | config.cache_store = :null_store
31 | end
32 |
33 | # Store uploaded files on the local file system (see config/storage.yml for options)
34 | config.active_storage.service = :local
35 |
36 | # Don't care if the mailer can't send.
37 | config.action_mailer.raise_delivery_errors = false
38 |
39 | config.action_mailer.perform_caching = false
40 |
41 | # Print deprecation notices to the Rails logger.
42 | config.active_support.deprecation = :log
43 |
44 | # Raise an error on page load if there are pending migrations.
45 | config.active_record.migration_error = :page_load
46 |
47 | # Highlight code that triggered database queries in logs.
48 | config.active_record.verbose_query_logs = true
49 |
50 | # Debug mode disables concatenation and preprocessing of assets.
51 | # This option may cause significant delays in view rendering with a large
52 | # number of complex assets.
53 | config.assets.debug = true
54 |
55 | # Suppress logger output for asset requests.
56 | config.assets.quiet = true
57 |
58 | # Raises error for missing translations
59 | # config.action_view.raise_on_missing_translations = true
60 |
61 | # Use an evented file watcher to asynchronously detect changes in source code,
62 | # routes, locales, etc. This feature depends on the listen gem.
63 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker
64 | end
65 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Verifies that versions and hashed value of the package contents in the project's package.json
3 | config.webpacker.check_yarn_integrity = false
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # Code is not reloaded between requests.
7 | config.cache_classes = true
8 |
9 | # Eager load code on boot. This eager loads most of Rails and
10 | # your application in memory, allowing both threaded web servers
11 | # and those relying on copy on write to perform better.
12 | # Rake tasks automatically ignore this option for performance.
13 | config.eager_load = true
14 |
15 | # Full error reports are disabled and caching is turned on.
16 | config.consider_all_requests_local = false
17 | config.action_controller.perform_caching = true
18 |
19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21 | # config.require_master_key = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
26 |
27 | # Compress JavaScripts and CSS.
28 | config.assets.js_compressor = :uglifier
29 | # config.assets.css_compressor = :sass
30 |
31 | # Do not fallback to assets pipeline if a precompiled asset is missed.
32 | config.assets.compile = false
33 |
34 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
35 |
36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
37 | # config.action_controller.asset_host = 'http://assets.example.com'
38 |
39 | # Specifies the header that your server uses for sending files.
40 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
41 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
42 |
43 | # Store uploaded files on the local file system (see config/storage.yml for options)
44 | config.active_storage.service = :local
45 |
46 | # Mount Action Cable outside main process or domain
47 | # config.action_cable.mount_path = nil
48 | # config.action_cable.url = 'wss://example.com/cable'
49 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
50 |
51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
52 | # config.force_ssl = true
53 |
54 | # Use the lowest log level to ensure availability of diagnostic information
55 | # when problems arise.
56 | config.log_level = :debug
57 |
58 | # Prepend all log lines with the following tags.
59 | config.log_tags = [ :request_id ]
60 |
61 | # Use a different cache store in production.
62 | # config.cache_store = :mem_cache_store
63 |
64 | # Use a real queuing backend for Active Job (and separate queues per environment)
65 | # config.active_job.queue_adapter = :resque
66 | # config.active_job.queue_name_prefix = "nested_forms_#{Rails.env}"
67 |
68 | config.action_mailer.perform_caching = false
69 |
70 | # Ignore bad email addresses and do not raise email delivery errors.
71 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72 | # config.action_mailer.raise_delivery_errors = false
73 |
74 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75 | # the I18n.default_locale when a translation cannot be found).
76 | config.i18n.fallbacks = true
77 |
78 | # Send deprecation notices to registered listeners.
79 | config.active_support.deprecation = :notify
80 |
81 | # Use default logging formatter so that PID and timestamp are not suppressed.
82 | config.log_formatter = ::Logger::Formatter.new
83 |
84 | # Use a different logger for distributed setups.
85 | # require 'syslog/logger'
86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
87 |
88 | if ENV["RAILS_LOG_TO_STDOUT"].present?
89 | logger = ActiveSupport::Logger.new(STDOUT)
90 | logger.formatter = config.log_formatter
91 | config.logger = ActiveSupport::TaggedLogging.new(logger)
92 | end
93 |
94 | # Do not dump schema after migrations.
95 | config.active_record.dump_schema_after_migration = false
96 | end
97 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 |
31 | # Store uploaded files on the local file system in a temporary directory
32 | config.active_storage.service = :test
33 |
34 | config.action_mailer.perform_caching = false
35 |
36 | # Tell Action Mailer not to deliver emails to the real world.
37 | # The :test delivery method accumulates sent emails in the
38 | # ActionMailer::Base.deliveries array.
39 | config.action_mailer.delivery_method = :test
40 |
41 | # Print deprecation notices to the stderr.
42 | config.active_support.deprecation = :stderr
43 |
44 | # Raises error for missing translations
45 | # config.action_view.raise_on_missing_translations = true
46 | end
47 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 | # Add Yarn node_modules folder to the asset load path.
9 | Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 |
11 | # Precompile additional assets.
12 | # application.js, application.css, and all non-JS/CSS in the app/assets
13 | # folder are already added.
14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
15 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
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!
8 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy
4 | # For further information see the following documentation
5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 |
7 | # Rails.application.config.content_security_policy do |policy|
8 | # policy.default_src :self, :https
9 | # policy.font_src :self, :https, :data
10 | # policy.img_src :self, :https, :data
11 | # policy.object_src :none
12 | # policy.script_src :self, :https
13 | # policy.style_src :self, :https
14 |
15 | # # Specify URI for violation reports
16 | # # policy.report_uri "/csp-violation-report-endpoint"
17 | # end
18 |
19 | # If you are using UJS then enable automatic nonce generation
20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21 |
22 | # Report CSP violations to a specified URI
23 | # For further information see the following documentation:
24 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 | # Rails.application.config.content_security_policy_report_only = true
26 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | # Use this hook to configure devise mailer, warden hooks and so forth.
4 | # Many of these configuration options can be set straight in your model.
5 | Devise.setup do |config|
6 | # The secret key used by Devise. Devise uses this key to generate
7 | # random tokens. Changing this key will render invalid all existing
8 | # confirmation, reset password and unlock tokens in the database.
9 | # Devise will use the `secret_key_base` as its `secret_key`
10 | # by default. You can change it below and use your own secret key.
11 | config.secret_key = Rails.application.credentials.secret_key_base
12 |
13 | # ==> Controller configuration
14 | # Configure the parent class to the devise controllers.
15 | # config.parent_controller = 'DeviseController'
16 |
17 | # ==> Mailer Configuration
18 | # Configure the e-mail address which will be shown in Devise::Mailer,
19 | # note that it will be overwritten if you use your own mailer class
20 | # with default "from" parameter.
21 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
22 |
23 | # Configure the class responsible to send e-mails.
24 | # config.mailer = 'Devise::Mailer'
25 |
26 | # Configure the parent class responsible to send e-mails.
27 | # config.parent_mailer = 'ActionMailer::Base'
28 |
29 | # ==> ORM configuration
30 | # Load and configure the ORM. Supports :active_record (default) and
31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
32 | # available as additional gems.
33 | require 'devise/orm/active_record'
34 |
35 | # ==> Configuration for any authentication mechanism
36 | # Configure which keys are used when authenticating a user. The default is
37 | # just :email. You can configure it to use [:username, :subdomain], so for
38 | # authenticating a user, both parameters are required. Remember that those
39 | # parameters are used only when authenticating and not when retrieving from
40 | # session. If you need permissions, you should implement that in a before filter.
41 | # You can also supply a hash where the value is a boolean determining whether
42 | # or not authentication should be aborted when the value is not present.
43 | # config.authentication_keys = [:email]
44 |
45 | # Configure parameters from the request object used for authentication. Each entry
46 | # given should be a request method and it will automatically be passed to the
47 | # find_for_authentication method and considered in your model lookup. For instance,
48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
49 | # The same considerations mentioned for authentication_keys also apply to request_keys.
50 | # config.request_keys = []
51 |
52 | # Configure which authentication keys should be case-insensitive.
53 | # These keys will be downcased upon creating or modifying a user and when used
54 | # to authenticate or find a user. Default is :email.
55 | config.case_insensitive_keys = [:email]
56 |
57 | # Configure which authentication keys should have whitespace stripped.
58 | # These keys will have whitespace before and after removed upon creating or
59 | # modifying a user and when used to authenticate or find a user. Default is :email.
60 | config.strip_whitespace_keys = [:email]
61 |
62 | # Tell if authentication through request.params is enabled. True by default.
63 | # It can be set to an array that will enable params authentication only for the
64 | # given strategies, for example, `config.params_authenticatable = [:database]` will
65 | # enable it only for database (email + password) authentication.
66 | # config.params_authenticatable = true
67 |
68 | # Tell if authentication through HTTP Auth is enabled. False by default.
69 | # It can be set to an array that will enable http authentication only for the
70 | # given strategies, for example, `config.http_authenticatable = [:database]` will
71 | # enable it only for database authentication. The supported strategies are:
72 | # :database = Support basic authentication with authentication key + password
73 | # config.http_authenticatable = false
74 |
75 | # If 401 status code should be returned for AJAX requests. True by default.
76 | # config.http_authenticatable_on_xhr = true
77 |
78 | # The realm used in Http Basic Authentication. 'Application' by default.
79 | # config.http_authentication_realm = 'Application'
80 |
81 | # It will change confirmation, password recovery and other workflows
82 | # to behave the same regardless if the e-mail provided was right or wrong.
83 | # Does not affect registerable.
84 | # config.paranoid = true
85 |
86 | # By default Devise will store the user in session. You can skip storage for
87 | # particular strategies by setting this option.
88 | # Notice that if you are skipping storage for all authentication paths, you
89 | # may want to disable generating routes to Devise's sessions controller by
90 | # passing skip: :sessions to `devise_for` in your config/routes.rb
91 | config.skip_session_storage = [:http_auth]
92 |
93 | # By default, Devise cleans up the CSRF token on authentication to
94 | # avoid CSRF token fixation attacks. This means that, when using AJAX
95 | # requests for sign in and sign up, you need to get a new CSRF token
96 | # from the server. You can disable this option at your own risk.
97 | # config.clean_up_csrf_token_on_authentication = true
98 |
99 | # When false, Devise will not attempt to reload routes on eager load.
100 | # This can reduce the time taken to boot the app but if your application
101 | # requires the Devise mappings to be loaded during boot time the application
102 | # won't boot properly.
103 | # config.reload_routes = true
104 |
105 | # ==> Configuration for :database_authenticatable
106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
107 | # using other algorithms, it sets how many times you want the password to be hashed.
108 | #
109 | # Limiting the stretches to just one in testing will increase the performance of
110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
111 | # a value less than 10 in other environments. Note that, for bcrypt (the default
112 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
114 | config.stretches = Rails.env.test? ? 1 : 11
115 |
116 | # Set up a pepper to generate the hashed password.
117 | # config.pepper = 'e3e8ef897a7e4fd305d72d401e799ac07246c2d67532b64d5ce5388b84a329caa8e5649a982e9cffdd7b16bfad927eaf0e9ccfac7809eac9aff32fc6c35e2da1'
118 |
119 | # Send a notification to the original email when the user's email is changed.
120 | # config.send_email_changed_notification = false
121 |
122 | # Send a notification email when the user's password is changed.
123 | # config.send_password_change_notification = false
124 |
125 | # ==> Configuration for :confirmable
126 | # A period that the user is allowed to access the website even without
127 | # confirming their account. For instance, if set to 2.days, the user will be
128 | # able to access the website for two days without confirming their account,
129 | # access will be blocked just in the third day. Default is 0.days, meaning
130 | # the user cannot access the website without confirming their account.
131 | # config.allow_unconfirmed_access_for = 2.days
132 |
133 | # A period that the user is allowed to confirm their account before their
134 | # token becomes invalid. For example, if set to 3.days, the user can confirm
135 | # their account within 3 days after the mail was sent, but on the fourth day
136 | # their account can't be confirmed with the token any more.
137 | # Default is nil, meaning there is no restriction on how long a user can take
138 | # before confirming their account.
139 | # config.confirm_within = 3.days
140 |
141 | # If true, requires any email changes to be confirmed (exactly the same way as
142 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
143 | # db field (see migrations). Until confirmed, new email is stored in
144 | # unconfirmed_email column, and copied to email column on successful confirmation.
145 | config.reconfirmable = true
146 |
147 | # Defines which key will be used when confirming an account
148 | # config.confirmation_keys = [:email]
149 |
150 | # ==> Configuration for :rememberable
151 | # The time the user will be remembered without asking for credentials again.
152 | # config.remember_for = 2.weeks
153 |
154 | # Invalidates all the remember me tokens when the user signs out.
155 | config.expire_all_remember_me_on_sign_out = true
156 |
157 | # If true, extends the user's remember period when remembered via cookie.
158 | # config.extend_remember_period = false
159 |
160 | # Options to be passed to the created cookie. For instance, you can set
161 | # secure: true in order to force SSL only cookies.
162 | # config.rememberable_options = {}
163 |
164 | # ==> Configuration for :validatable
165 | # Range for password length.
166 | config.password_length = 6..128
167 |
168 | # Email regex used to validate email formats. It simply asserts that
169 | # one (and only one) @ exists in the given string. This is mainly
170 | # to give user feedback and not to assert the e-mail validity.
171 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
172 |
173 | # ==> Configuration for :timeoutable
174 | # The time you want to timeout the user session without activity. After this
175 | # time the user will be asked for credentials again. Default is 30 minutes.
176 | # config.timeout_in = 30.minutes
177 |
178 | # ==> Configuration for :lockable
179 | # Defines which strategy will be used to lock an account.
180 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
181 | # :none = No lock strategy. You should handle locking by yourself.
182 | # config.lock_strategy = :failed_attempts
183 |
184 | # Defines which key will be used when locking and unlocking an account
185 | # config.unlock_keys = [:email]
186 |
187 | # Defines which strategy will be used to unlock an account.
188 | # :email = Sends an unlock link to the user email
189 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
190 | # :both = Enables both strategies
191 | # :none = No unlock strategy. You should handle unlocking by yourself.
192 | # config.unlock_strategy = :both
193 |
194 | # Number of authentication tries before locking an account if lock_strategy
195 | # is failed attempts.
196 | # config.maximum_attempts = 20
197 |
198 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
199 | # config.unlock_in = 1.hour
200 |
201 | # Warn on the last attempt before the account is locked.
202 | # config.last_attempt_warning = true
203 |
204 | # ==> Configuration for :recoverable
205 | #
206 | # Defines which key will be used when recovering the password for an account
207 | # config.reset_password_keys = [:email]
208 |
209 | # Time interval you can reset your password with a reset password key.
210 | # Don't put a too small interval or your users won't have the time to
211 | # change their passwords.
212 | config.reset_password_within = 6.hours
213 |
214 | # When set to false, does not sign a user in automatically after their password is
215 | # reset. Defaults to true, so a user is signed in automatically after a reset.
216 | # config.sign_in_after_reset_password = true
217 |
218 | # ==> Configuration for :encryptable
219 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
220 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
221 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
222 | # for default behavior) and :restful_authentication_sha1 (then you should set
223 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
224 | #
225 | # Require the `devise-encryptable` gem when using anything other than bcrypt
226 | # config.encryptor = :sha512
227 |
228 | # ==> Scopes configuration
229 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
230 | # "users/sessions/new". It's turned off by default because it's slower if you
231 | # are using only default views.
232 | # config.scoped_views = false
233 |
234 | # Configure the default scope given to Warden. By default it's the first
235 | # devise role declared in your routes (usually :user).
236 | # config.default_scope = :user
237 |
238 | # Set this configuration to false if you want /users/sign_out to sign out
239 | # only the current scope. By default, Devise signs out all scopes.
240 | # config.sign_out_all_scopes = true
241 |
242 | # ==> Navigation configuration
243 | # Lists the formats that should be treated as navigational. Formats like
244 | # :html, should redirect to the sign in page when the user does not have
245 | # access, but formats like :xml or :json, should return 401.
246 | #
247 | # If you have any extra navigational formats, like :iphone or :mobile, you
248 | # should add them to the navigational formats lists.
249 | #
250 | # The "*/*" below is required to match Internet Explorer requests.
251 | # config.navigational_formats = ['*/*', :html]
252 |
253 | # The default HTTP method used to sign out a resource. Default is :delete.
254 | config.sign_out_via = :delete
255 |
256 | # ==> OmniAuth
257 | # Add a new OmniAuth provider. Check the wiki for more information on setting
258 | # up on your models and hooks.
259 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
260 |
261 | env_creds = Rails.application.credentials[Rails.env.to_sym] || {}
262 | %w{ facebook twitter github }.each do |provider|
263 | if options = env_creds[provider]
264 | config.omniauth provider, options[:app_id], options[:app_secret], options.fetch(:options, {})
265 | end
266 | end
267 |
268 | # ==> Warden configuration
269 | # If you want to use other strategies, that are not supported by Devise, or
270 | # change the failure app, you can configure them inside the config.warden block.
271 | #
272 | # config.warden do |manager|
273 | # manager.intercept_401 = false
274 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
275 | # end
276 |
277 | # ==> Mountable engine configurations
278 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
279 | # is mountable, there are some extra configurations to be taken into account.
280 | # The following options are available, assuming the engine is mounted as:
281 | #
282 | # mount MyEngine, at: '/my_engine'
283 | #
284 | # The router that invoked `devise_for`, in the example above, would be:
285 | # config.router_name = :my_engine
286 | #
287 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
288 | # so you need to do it manually. For the users scope, it would be:
289 | # config.omniauth_path_prefix = '/my_engine/users/auth'
290 |
291 | # ==> Turbolinks configuration
292 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
293 | #
294 | # ActiveSupport.on_load(:devise_failure_app) do
295 | # include Turbolinks::Controller
296 | # end
297 | end
298 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/config/initializers/friendly_id.rb:
--------------------------------------------------------------------------------
1 | # FriendlyId Global Configuration
2 | #
3 | # Use this to set up shared configuration options for your entire application.
4 | # Any of the configuration options shown here can also be applied to single
5 | # models by passing arguments to the `friendly_id` class method or defining
6 | # methods in your model.
7 | #
8 | # To learn more, check out the guide:
9 | #
10 | # http://norman.github.io/friendly_id/file.Guide.html
11 |
12 | FriendlyId.defaults do |config|
13 | # ## Reserved Words
14 | #
15 | # Some words could conflict with Rails's routes when used as slugs, or are
16 | # undesirable to allow as slugs. Edit this list as needed for your app.
17 | config.use :reserved
18 |
19 | config.reserved_words = %w(new edit index session login logout users admin
20 | stylesheets assets javascripts images)
21 |
22 | # This adds an option to treat reserved words as conflicts rather than exceptions.
23 | # When there is no good candidate, a UUID will be appended, matching the existing
24 | # conflict behavior.
25 |
26 | # config.treat_reserved_as_conflict = true
27 |
28 | # ## Friendly Finders
29 | #
30 | # Uncomment this to use friendly finders in all models. By default, if
31 | # you wish to find a record by its friendly id, you must do:
32 | #
33 | # MyModel.friendly.find('foo')
34 | #
35 | # If you uncomment this, you can do:
36 | #
37 | # MyModel.find('foo')
38 | #
39 | # This is significantly more convenient but may not be appropriate for
40 | # all applications, so you must explicity opt-in to this behavior. You can
41 | # always also configure it on a per-model basis if you prefer.
42 | #
43 | # Something else to consider is that using the :finders addon boosts
44 | # performance because it will avoid Rails-internal code that makes runtime
45 | # calls to `Module.extend`.
46 | #
47 | # config.use :finders
48 | #
49 | # ## Slugs
50 | #
51 | # Most applications will use the :slugged module everywhere. If you wish
52 | # to do so, uncomment the following line.
53 | #
54 | # config.use :slugged
55 | #
56 | # By default, FriendlyId's :slugged addon expects the slug column to be named
57 | # 'slug', but you can change it if you wish.
58 | #
59 | # config.slug_column = 'slug'
60 | #
61 | # By default, slug has no size limit, but you can change it if you wish.
62 | #
63 | # config.slug_limit = 255
64 | #
65 | # When FriendlyId can not generate a unique ID from your base method, it appends
66 | # a UUID, separated by a single dash. You can configure the character used as the
67 | # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
68 | # with two dashes.
69 | #
70 | # config.sequence_separator = '-'
71 | #
72 | # Note that you must use the :slugged addon **prior** to the line which
73 | # configures the sequence separator, or else FriendlyId will raise an undefined
74 | # method error.
75 | #
76 | # ## Tips and Tricks
77 | #
78 | # ### Controlling when slugs are generated
79 | #
80 | # As of FriendlyId 5.0, new slugs are generated only when the slug field is
81 | # nil, but if you're using a column as your base method can change this
82 | # behavior by overriding the `should_generate_new_friendly_id?` method that
83 | # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
84 | # more like 4.0.
85 | # Note: Use(include) Slugged module in the config if using the anonymous module.
86 | # If you have `friendly_id :name, use: slugged` in the model, Slugged module
87 | # is included after the anonymous module defined in the initializer, so it
88 | # overrides the `should_generate_new_friendly_id?` method from the anonymous module.
89 | #
90 | # config.use :slugged
91 | # config.use Module.new {
92 | # def should_generate_new_friendly_id?
93 | # slug.blank? || _changed?
94 | # end
95 | # }
96 | #
97 | # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
98 | # languages that don't use the Roman alphabet, that's not usually sufficient.
99 | # Here we use the Babosa library to transliterate Russian Cyrillic slugs to
100 | # ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
101 | #
102 | # config.use Module.new {
103 | # def normalize_friendly_id(text)
104 | # text.to_slug.normalize! :transliterations => [:russian, :latin]
105 | # end
106 | # }
107 | end
108 |
--------------------------------------------------------------------------------
/config/initializers/gravatar.rb:
--------------------------------------------------------------------------------
1 | GravatarImageTag.configure do |config|
2 | config.default_image = "mm"
3 | config.secure = true
4 | end
5 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
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
17 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
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]
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
15 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | sessions:
48 | signed_in: "Signed in successfully."
49 | signed_out: "Signed out successfully."
50 | already_signed_out: "Signed out successfully."
51 | unlocks:
52 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
53 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
54 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
55 | errors:
56 | messages:
57 | already_confirmed: "was already confirmed, please try signing in"
58 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
59 | expired: "has expired, please request a new one"
60 | not_found: "not found"
61 | not_locked: "was not locked"
62 | not_saved:
63 | one: "1 error prohibited this %{resource} from being saved:"
64 | other: "%{count} errors prohibited this %{resource} from being saved:"
65 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
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 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # 'true': 'foo'
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at http://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | threads threads_count, threads_count
9 |
10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11 | #
12 | port ENV.fetch("PORT") { 3000 }
13 |
14 | # Specifies the `environment` that Puma will run in.
15 | #
16 | environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # Specifies the number of `workers` to boot in clustered mode.
19 | # Workers are forked webserver processes. If using threads and workers together
20 | # the concurrency of the application would be max `threads` * `workers`.
21 | # Workers do not work on JRuby or Windows (both of which do not support
22 | # processes).
23 | #
24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # Use the `preload_app!` method when specifying a `workers` number.
27 | # This directive tells Puma to first boot the application and load code
28 | # before forking the application. This takes advantage of Copy On Write
29 | # process behavior so workers use less memory.
30 | #
31 | # preload_app!
32 |
33 | # Allow puma to be restarted by `rails restart` command.
34 | plugin :tmp_restart
35 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | require 'sidekiq/web'
2 |
3 | Rails.application.routes.draw do
4 | resources :projects
5 | namespace :admin do
6 | resources :users
7 | resources :announcements
8 | resources :notifications
9 | resources :services
10 |
11 | root to: "users#index"
12 | end
13 | get '/privacy', to: 'home#privacy'
14 | get '/terms', to: 'home#terms'
15 | resources :notifications, only: [:index]
16 | resources :announcements, only: [:index]
17 | authenticate :user, lambda { |u| u.admin? } do
18 | mount Sidekiq::Web => '/sidekiq'
19 | end
20 |
21 | devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }
22 | root to: 'home#index'
23 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
24 | end
25 |
--------------------------------------------------------------------------------
/config/schedule.rb:
--------------------------------------------------------------------------------
1 | # Use this file to easily define all of your cron jobs.
2 | #
3 | # It's helpful, but not entirely necessary to understand cron before proceeding.
4 | # http://en.wikipedia.org/wiki/Cron
5 |
6 | # Example:
7 | #
8 | # set :output, "/path/to/my/cron_log.log"
9 | #
10 | # every 2.hours do
11 | # command "/usr/bin/some_great_command"
12 | # runner "MyModel.some_method"
13 | # rake "some:great:rake:task"
14 | # end
15 | #
16 | # every 4.days do
17 | # runner "AnotherModel.prune_old_records"
18 | # end
19 |
20 | # Learn more: http://github.com/javan/whenever
21 |
--------------------------------------------------------------------------------
/config/sitemap.rb:
--------------------------------------------------------------------------------
1 | # Set the host name for URL creation
2 | SitemapGenerator::Sitemap.default_host = "http://www.example.com"
3 |
4 | SitemapGenerator::Sitemap.create do
5 | # Put links creation logic here.
6 | #
7 | # The root path '/' and sitemap index file are added automatically for you.
8 | # Links are added to the Sitemap in the order they are specified.
9 | #
10 | # Usage: add(path, options={})
11 | # (default options are used if you don't specify)
12 | #
13 | # Defaults: :priority => 0.5, :changefreq => 'weekly',
14 | # :lastmod => Time.now, :host => default_host
15 | #
16 | # Examples:
17 | #
18 | # Add '/articles'
19 | #
20 | # add articles_path, :priority => 0.7, :changefreq => 'daily'
21 | #
22 | # Add all articles:
23 | #
24 | # Article.find_each do |article|
25 | # add article_path(article), :lastmod => article.updated_at
26 | # end
27 | end
28 |
--------------------------------------------------------------------------------
/config/spring.rb:
--------------------------------------------------------------------------------
1 | %w[
2 | .ruby-version
3 | .rbenv-vars
4 | tmp/restart.txt
5 | tmp/caching-dev.txt
6 | ].each { |path| Spring.watch(path) }
7 |
--------------------------------------------------------------------------------
/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket
23 |
24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/config/webpack/development.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2 |
3 | const environment = require('./environment')
4 |
5 | module.exports = environment.toWebpackConfig()
6 |
--------------------------------------------------------------------------------
/config/webpack/environment.js:
--------------------------------------------------------------------------------
1 | const { environment } = require('@rails/webpacker')
2 |
3 | module.exports = environment
4 |
--------------------------------------------------------------------------------
/config/webpack/production.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production'
2 |
3 | const environment = require('./environment')
4 |
5 | module.exports = environment.toWebpackConfig()
6 |
--------------------------------------------------------------------------------
/config/webpack/test.js:
--------------------------------------------------------------------------------
1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development'
2 |
3 | const environment = require('./environment')
4 |
5 | module.exports = environment.toWebpackConfig()
6 |
--------------------------------------------------------------------------------
/config/webpacker.yml:
--------------------------------------------------------------------------------
1 | # Note: You must restart bin/webpack-dev-server for changes to take effect
2 |
3 | default: &default
4 | source_path: app/javascript
5 | source_entry_path: packs
6 | public_output_path: packs
7 | cache_path: tmp/cache/webpacker
8 |
9 | # Additional paths webpack should lookup modules
10 | # ['app/assets', 'engine/foo/app/assets']
11 | resolved_paths: []
12 |
13 | # Reload manifest.json on all requests so we reload latest compiled packs
14 | cache_manifest: false
15 |
16 | extensions:
17 | - .js
18 | - .sass
19 | - .scss
20 | - .css
21 | - .module.sass
22 | - .module.scss
23 | - .module.css
24 | - .png
25 | - .svg
26 | - .gif
27 | - .jpeg
28 | - .jpg
29 |
30 | development:
31 | <<: *default
32 | compile: true
33 |
34 | # Reference: https://webpack.js.org/configuration/dev-server/
35 | dev_server:
36 | https: false
37 | host: localhost
38 | port: 3035
39 | public: localhost:3035
40 | hmr: false
41 | # Inline should be set to true if using HMR
42 | inline: true
43 | overlay: true
44 | compress: true
45 | disable_host_check: true
46 | use_local_ip: false
47 | quiet: false
48 | headers:
49 | 'Access-Control-Allow-Origin': '*'
50 | watch_options:
51 | ignored: /node_modules/
52 |
53 |
54 | test:
55 | <<: *default
56 | compile: true
57 |
58 | # Compile test packs to a separate directory
59 | public_output_path: packs-test
60 |
61 | production:
62 | <<: *default
63 |
64 | # Production depends on precompilation of packs prior to booting for performance.
65 | compile: false
66 |
67 | # Cache manifest.json for performance
68 | cache_manifest: true
69 |
--------------------------------------------------------------------------------
/db/migrate/20190206223559_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | # frozen_string_literal: true
2 |
3 | class DeviseCreateUsers < ActiveRecord::Migration[5.2]
4 | def change
5 | create_table :users do |t|
6 | ## Database authenticatable
7 | t.string :email, null: false, default: ""
8 | t.string :encrypted_password, null: false, default: ""
9 |
10 | ## Recoverable
11 | t.string :reset_password_token
12 | t.datetime :reset_password_sent_at
13 |
14 | ## Rememberable
15 | t.datetime :remember_created_at
16 |
17 | ## Trackable
18 | # t.integer :sign_in_count, default: 0, null: false
19 | # t.datetime :current_sign_in_at
20 | # t.datetime :last_sign_in_at
21 | # t.inet :current_sign_in_ip
22 | # t.inet :last_sign_in_ip
23 |
24 | ## Confirmable
25 | # t.string :confirmation_token
26 | # t.datetime :confirmed_at
27 | # t.datetime :confirmation_sent_at
28 | # t.string :unconfirmed_email # Only if using reconfirmable
29 |
30 | ## Lockable
31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
32 | # t.string :unlock_token # Only if unlock strategy is :email or :both
33 | # t.datetime :locked_at
34 |
35 | t.string :first_name
36 | t.string :last_name
37 | t.datetime :announcements_last_read_at
38 | t.boolean :admin, default: false
39 |
40 | t.timestamps null: false
41 | end
42 |
43 | add_index :users, :email, unique: true
44 | add_index :users, :reset_password_token, unique: true
45 | # add_index :users, :confirmation_token, unique: true
46 | # add_index :users, :unlock_token, unique: true
47 | end
48 | end
49 |
--------------------------------------------------------------------------------
/db/migrate/20190206223625_create_announcements.rb:
--------------------------------------------------------------------------------
1 | class CreateAnnouncements < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :announcements do |t|
4 | t.datetime :published_at
5 | t.string :announcement_type
6 | t.string :name
7 | t.text :description
8 |
9 | t.timestamps
10 | end
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/db/migrate/20190206223626_create_notifications.rb:
--------------------------------------------------------------------------------
1 | class CreateNotifications < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :notifications do |t|
4 | t.bigint :recipient_id
5 | t.bigint :actor_id
6 | t.datetime :read_at
7 | t.string :action
8 | t.bigint :notifiable_id
9 | t.string :notifiable_type
10 |
11 | t.timestamps
12 | end
13 | end
14 | end
15 |
--------------------------------------------------------------------------------
/db/migrate/20190206223627_create_services.rb:
--------------------------------------------------------------------------------
1 | class CreateServices < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :services do |t|
4 | t.references :user, foreign_key: true
5 | t.string :provider
6 | t.string :uid
7 | t.string :access_token
8 | t.string :access_token_secret
9 | t.string :refresh_token
10 | t.datetime :expires_at
11 | t.text :auth
12 |
13 | t.timestamps
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/db/migrate/20190206223628_create_friendly_id_slugs.rb:
--------------------------------------------------------------------------------
1 | MIGRATION_CLASS =
2 | if ActiveRecord::VERSION::MAJOR >= 5
3 | ActiveRecord::Migration[5.2]["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"]
4 | else
5 | ActiveRecord::Migration[5.2]
6 | end
7 |
8 | class CreateFriendlyIdSlugs < MIGRATION_CLASS
9 | def change
10 | create_table :friendly_id_slugs do |t|
11 | t.string :slug, :null => false
12 | t.integer :sluggable_id, :null => false
13 | t.string :sluggable_type, :limit => 50
14 | t.string :scope
15 | t.datetime :created_at
16 | end
17 | add_index :friendly_id_slugs, [:sluggable_type, :sluggable_id]
18 | add_index :friendly_id_slugs, [:slug, :sluggable_type], length: { slug: 140, sluggable_type: 50 }
19 | add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/db/migrate/20190206223826_create_projects.rb:
--------------------------------------------------------------------------------
1 | class CreateProjects < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :projects do |t|
4 | t.string :name
5 | t.string :description
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/migrate/20190206223844_create_tasks.rb:
--------------------------------------------------------------------------------
1 | class CreateTasks < ActiveRecord::Migration[5.2]
2 | def change
3 | create_table :tasks do |t|
4 | t.string :description
5 | t.belongs_to :project, foreign_key: true
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 2019_02_06_223844) do
14 |
15 | # These are extensions that must be enabled in order to support this database
16 | enable_extension "plpgsql"
17 |
18 | create_table "announcements", force: :cascade do |t|
19 | t.datetime "published_at"
20 | t.string "announcement_type"
21 | t.string "name"
22 | t.text "description"
23 | t.datetime "created_at", null: false
24 | t.datetime "updated_at", null: false
25 | end
26 |
27 | create_table "friendly_id_slugs", force: :cascade do |t|
28 | t.string "slug", null: false
29 | t.integer "sluggable_id", null: false
30 | t.string "sluggable_type", limit: 50
31 | t.string "scope"
32 | t.datetime "created_at"
33 | t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
34 | t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
35 | t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id"
36 | end
37 |
38 | create_table "notifications", force: :cascade do |t|
39 | t.bigint "recipient_id"
40 | t.bigint "actor_id"
41 | t.datetime "read_at"
42 | t.string "action"
43 | t.bigint "notifiable_id"
44 | t.string "notifiable_type"
45 | t.datetime "created_at", null: false
46 | t.datetime "updated_at", null: false
47 | end
48 |
49 | create_table "projects", force: :cascade do |t|
50 | t.string "name"
51 | t.string "description"
52 | t.datetime "created_at", null: false
53 | t.datetime "updated_at", null: false
54 | end
55 |
56 | create_table "services", force: :cascade do |t|
57 | t.bigint "user_id"
58 | t.string "provider"
59 | t.string "uid"
60 | t.string "access_token"
61 | t.string "access_token_secret"
62 | t.string "refresh_token"
63 | t.datetime "expires_at"
64 | t.text "auth"
65 | t.datetime "created_at", null: false
66 | t.datetime "updated_at", null: false
67 | t.index ["user_id"], name: "index_services_on_user_id"
68 | end
69 |
70 | create_table "tasks", force: :cascade do |t|
71 | t.string "description"
72 | t.bigint "project_id"
73 | t.datetime "created_at", null: false
74 | t.datetime "updated_at", null: false
75 | t.index ["project_id"], name: "index_tasks_on_project_id"
76 | end
77 |
78 | create_table "users", force: :cascade do |t|
79 | t.string "email", default: "", null: false
80 | t.string "encrypted_password", default: "", null: false
81 | t.string "reset_password_token"
82 | t.datetime "reset_password_sent_at"
83 | t.datetime "remember_created_at"
84 | t.string "first_name"
85 | t.string "last_name"
86 | t.datetime "announcements_last_read_at"
87 | t.boolean "admin", default: false
88 | t.datetime "created_at", null: false
89 | t.datetime "updated_at", null: false
90 | t.index ["email"], name: "index_users_on_email", unique: true
91 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
92 | end
93 |
94 | add_foreign_key "services", "users"
95 | add_foreign_key "tasks", "projects"
96 | end
97 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7 | # Character.create(name: 'Luke', movie: movies.first)
8 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/lib/assets/.keep
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/lib/tasks/.keep
--------------------------------------------------------------------------------
/lib/templates/erb/scaffold/_form.html.erb:
--------------------------------------------------------------------------------
1 | <%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %>
2 | <%% if <%= singular_table_name %>.errors.any? %>
3 |
4 |
<%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved: