rails 7/ruby 3
This commit is contained in:
parent
855b4ac779
commit
2b77bc9fb8
3
Gemfile
3
Gemfile
@ -1,11 +1,10 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'rails', '6.1.7'
|
gem 'rails', '7.0.4'
|
||||||
gem 'pg', '~> 1.4.5'
|
gem 'pg', '~> 1.4.5'
|
||||||
|
|
||||||
gem 'webpacker', '5.4.3'
|
gem 'webpacker', '5.4.3'
|
||||||
gem 'bootsnap', '>= 1.1.0', require: false
|
gem 'bootsnap', '>= 1.1.0', require: false
|
||||||
gem 'net-smtp'
|
|
||||||
|
|
||||||
gem 'oj', '~> 3.13.23'
|
gem 'oj', '~> 3.13.23'
|
||||||
|
|
||||||
|
135
Gemfile.lock
135
Gemfile.lock
@ -1,65 +1,73 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (6.1.7)
|
actioncable (7.0.4)
|
||||||
actionpack (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (6.1.7)
|
actionmailbox (7.0.4)
|
||||||
actionpack (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
activejob (= 6.1.7)
|
activejob (= 7.0.4)
|
||||||
activerecord (= 6.1.7)
|
activerecord (= 7.0.4)
|
||||||
activestorage (= 6.1.7)
|
activestorage (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
actionmailer (6.1.7)
|
net-imap
|
||||||
actionpack (= 6.1.7)
|
net-pop
|
||||||
actionview (= 6.1.7)
|
net-smtp
|
||||||
activejob (= 6.1.7)
|
actionmailer (7.0.4)
|
||||||
activesupport (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
|
actionview (= 7.0.4)
|
||||||
|
activejob (= 7.0.4)
|
||||||
|
activesupport (= 7.0.4)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
|
net-imap
|
||||||
|
net-pop
|
||||||
|
net-smtp
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (6.1.7)
|
actionpack (7.0.4)
|
||||||
actionview (= 6.1.7)
|
actionview (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
rack (~> 2.0, >= 2.0.9)
|
rack (~> 2.0, >= 2.2.0)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actiontext (6.1.7)
|
actiontext (7.0.4)
|
||||||
actionpack (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
activerecord (= 6.1.7)
|
activerecord (= 7.0.4)
|
||||||
activestorage (= 6.1.7)
|
activestorage (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (6.1.7)
|
actionview (7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
activejob (6.1.7)
|
activejob (7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (6.1.7)
|
activemodel (7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
activerecord (6.1.7)
|
activerecord (7.0.4)
|
||||||
activemodel (= 6.1.7)
|
activemodel (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
activestorage (6.1.7)
|
activerecord-import (1.4.1)
|
||||||
actionpack (= 6.1.7)
|
activerecord (>= 4.2)
|
||||||
activejob (= 6.1.7)
|
activestorage (7.0.4)
|
||||||
activerecord (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activejob (= 7.0.4)
|
||||||
|
activerecord (= 7.0.4)
|
||||||
|
activesupport (= 7.0.4)
|
||||||
marcel (~> 1.0)
|
marcel (~> 1.0)
|
||||||
mini_mime (>= 1.1.0)
|
mini_mime (>= 1.1.0)
|
||||||
activesupport (6.1.7)
|
activesupport (7.0.4)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 1.6, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (>= 5.1)
|
minitest (>= 5.1)
|
||||||
tzinfo (~> 2.0)
|
tzinfo (~> 2.0)
|
||||||
zeitwerk (~> 2.3)
|
|
||||||
bcrypt (3.1.18)
|
bcrypt (3.1.18)
|
||||||
bootsnap (1.14.0)
|
bootsnap (1.14.0)
|
||||||
msgpack (~> 1.2)
|
msgpack (~> 1.2)
|
||||||
@ -132,6 +140,10 @@ GEM
|
|||||||
minitest (5.16.3)
|
minitest (5.16.3)
|
||||||
msgpack (1.6.0)
|
msgpack (1.6.0)
|
||||||
nenv (0.3.0)
|
nenv (0.3.0)
|
||||||
|
net-imap (0.3.1)
|
||||||
|
net-protocol
|
||||||
|
net-pop (0.1.2)
|
||||||
|
net-protocol
|
||||||
net-protocol (0.1.3)
|
net-protocol (0.1.3)
|
||||||
timeout
|
timeout
|
||||||
net-smtp (0.3.3)
|
net-smtp (0.3.3)
|
||||||
@ -157,21 +169,20 @@ GEM
|
|||||||
rack
|
rack
|
||||||
rack-test (2.0.2)
|
rack-test (2.0.2)
|
||||||
rack (>= 1.3)
|
rack (>= 1.3)
|
||||||
rails (6.1.7)
|
rails (7.0.4)
|
||||||
actioncable (= 6.1.7)
|
actioncable (= 7.0.4)
|
||||||
actionmailbox (= 6.1.7)
|
actionmailbox (= 7.0.4)
|
||||||
actionmailer (= 6.1.7)
|
actionmailer (= 7.0.4)
|
||||||
actionpack (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
actiontext (= 6.1.7)
|
actiontext (= 7.0.4)
|
||||||
actionview (= 6.1.7)
|
actionview (= 7.0.4)
|
||||||
activejob (= 6.1.7)
|
activejob (= 7.0.4)
|
||||||
activemodel (= 6.1.7)
|
activemodel (= 7.0.4)
|
||||||
activerecord (= 6.1.7)
|
activerecord (= 7.0.4)
|
||||||
activestorage (= 6.1.7)
|
activestorage (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
bundler (>= 1.15.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 6.1.7)
|
railties (= 7.0.4)
|
||||||
sprockets-rails (>= 2.0.0)
|
|
||||||
rails-controller-testing (1.0.5)
|
rails-controller-testing (1.0.5)
|
||||||
actionpack (>= 5.0.1.rc1)
|
actionpack (>= 5.0.1.rc1)
|
||||||
actionview (>= 5.0.1.rc1)
|
actionview (>= 5.0.1.rc1)
|
||||||
@ -181,12 +192,13 @@ GEM
|
|||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.4.3)
|
rails-html-sanitizer (1.4.3)
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.3)
|
||||||
railties (6.1.7)
|
railties (7.0.4)
|
||||||
actionpack (= 6.1.7)
|
actionpack (= 7.0.4)
|
||||||
activesupport (= 6.1.7)
|
activesupport (= 7.0.4)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 12.2)
|
rake (>= 12.2)
|
||||||
thor (~> 1.0)
|
thor (~> 1.0)
|
||||||
|
zeitwerk (~> 2.5)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
rb-fsevent (0.11.2)
|
rb-fsevent (0.11.2)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
@ -216,13 +228,6 @@ GEM
|
|||||||
semantic_range (3.0.0)
|
semantic_range (3.0.0)
|
||||||
shellany (0.0.1)
|
shellany (0.0.1)
|
||||||
signed_multiset (0.2.1)
|
signed_multiset (0.2.1)
|
||||||
sprockets (4.1.1)
|
|
||||||
concurrent-ruby (~> 1.0)
|
|
||||||
rack (> 1, < 3)
|
|
||||||
sprockets-rails (3.4.2)
|
|
||||||
actionpack (>= 5.2)
|
|
||||||
activesupport (>= 5.2)
|
|
||||||
sprockets (>= 3.0.0)
|
|
||||||
sqlite3 (1.5.4)
|
sqlite3 (1.5.4)
|
||||||
mini_portile2 (~> 2.8.0)
|
mini_portile2 (~> 2.8.0)
|
||||||
thor (1.2.1)
|
thor (1.2.1)
|
||||||
@ -251,6 +256,7 @@ PLATFORMS
|
|||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
activerecord-import (~> 1.4.1)
|
||||||
bcrypt (~> 3.1.18)
|
bcrypt (~> 3.1.18)
|
||||||
bootsnap (>= 1.1.0)
|
bootsnap (>= 1.1.0)
|
||||||
dalli (~> 3.2.3)
|
dalli (~> 3.2.3)
|
||||||
@ -259,11 +265,10 @@ DEPENDENCIES
|
|||||||
guard (~> 2.18.0)
|
guard (~> 2.18.0)
|
||||||
guard-rspec
|
guard-rspec
|
||||||
kaminari (~> 1.2.2)
|
kaminari (~> 1.2.2)
|
||||||
net-smtp
|
|
||||||
oj (~> 3.13.23)
|
oj (~> 3.13.23)
|
||||||
pg (~> 1.4.5)
|
pg (~> 1.4.5)
|
||||||
puma (~> 5.6)
|
puma (~> 5.6)
|
||||||
rails (= 6.1.7)
|
rails (= 7.0.4)
|
||||||
rails-controller-testing
|
rails-controller-testing
|
||||||
redcarpet (~> 3.5.1)
|
redcarpet (~> 3.5.1)
|
||||||
rspec-rails (~> 6.0.1)
|
rspec-rails (~> 6.0.1)
|
||||||
|
@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
|
|||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
def verified_request?
|
def verified_request?
|
||||||
if request.content_type == "application/json"
|
if request.media_type == "application/json"
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
super()
|
super()
|
||||||
|
@ -91,15 +91,15 @@ class Food < Ingredient
|
|||||||
:vit_e,
|
:vit_e,
|
||||||
:vit_d,
|
:vit_d,
|
||||||
:vit_k,
|
:vit_k,
|
||||||
:cholesterol
|
:cholesterol,
|
||||||
|
[:lipids, :lipid],
|
||||||
|
[:density, :density_best_guess]
|
||||||
]
|
]
|
||||||
|
|
||||||
copy_fields.each do |f|
|
copy_fields.each do |f|
|
||||||
self.send("#{f}=".to_sym, food.send(f.to_sym))
|
to, from = f.is_a?(Array) ? f : [f, f]
|
||||||
|
self.send("#{to}=".to_sym, food.send(from.to_sym))
|
||||||
end
|
end
|
||||||
|
|
||||||
self.lipids = food.lipid
|
|
||||||
self.density = food.density_best_guess
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
APP_PATH = File.expand_path('../config/application', __dir__)
|
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||||
require_relative '../config/boot'
|
require_relative "../config/boot"
|
||||||
require 'rails/commands'
|
require "rails/commands"
|
||||||
|
4
bin/rake
4
bin/rake
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require_relative '../config/boot'
|
require_relative "../config/boot"
|
||||||
require 'rake'
|
require "rake"
|
||||||
Rake.application.run
|
Rake.application.run
|
||||||
|
20
bin/setup
20
bin/setup
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
require 'fileutils'
|
require "fileutils"
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = File.expand_path('..', __dir__)
|
APP_ROOT = File.expand_path("..", __dir__)
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
@ -13,21 +13,21 @@ FileUtils.chdir APP_ROOT do
|
|||||||
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
||||||
# Add necessary setup steps to this file.
|
# Add necessary setup steps to this file.
|
||||||
|
|
||||||
puts '== Installing dependencies =='
|
puts "== Installing dependencies =="
|
||||||
system! 'gem install bundler --conservative'
|
system! "gem install bundler --conservative"
|
||||||
system('bundle check') || system!('bundle install')
|
system("bundle check") || system!("bundle install")
|
||||||
|
|
||||||
# puts "\n== Copying sample files =="
|
# puts "\n== Copying sample files =="
|
||||||
# unless File.exist?('config/database.yml')
|
# unless File.exist?("config/database.yml")
|
||||||
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
|
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
puts "\n== Preparing database =="
|
puts "\n== Preparing database =="
|
||||||
system! 'bin/rails db:prepare'
|
system! "bin/rails db:prepare"
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system! 'bin/rails log:clear tmp:clear'
|
system! "bin/rails log:clear tmp:clear"
|
||||||
|
|
||||||
puts "\n== Restarting application server =="
|
puts "\n== Restarting application server =="
|
||||||
system! 'bin/rails restart'
|
system! "bin/rails restart"
|
||||||
end
|
end
|
||||||
|
@ -22,7 +22,7 @@ Bundler.require(*Rails.groups)
|
|||||||
module Parsley
|
module Parsley
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Initialize configuration defaults for originally generated Rails version.
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
config.load_defaults 6.0
|
config.load_defaults 7.0
|
||||||
|
|
||||||
config.action_dispatch.cookies_same_site_protection = :lax
|
config.action_dispatch.cookies_same_site_protection = :lax
|
||||||
config.active_record.collection_cache_versioning = true
|
config.active_record.collection_cache_versioning = true
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||||
|
|
||||||
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Load the Rails application.
|
# Load the Rails application.
|
||||||
require_relative 'application'
|
require_relative "application"
|
||||||
|
|
||||||
# Initialize the Rails application.
|
# Initialize the Rails application.
|
||||||
Rails.application.initialize!
|
Rails.application.initialize!
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# In the development environment your application's code is reloaded on
|
# In the development environment your application's code is reloaded any time
|
||||||
# every request. This slows down response time but is perfect for development
|
# it changes. This slows down response time but is perfect for development
|
||||||
# since you don't have to restart the web server when you make code changes.
|
# since you don't have to restart the web server when you make code changes.
|
||||||
config.cache_classes = false
|
config.cache_classes = false
|
||||||
|
|
||||||
@ -12,15 +14,18 @@ Rails.application.configure do
|
|||||||
# Show full error reports.
|
# Show full error reports.
|
||||||
config.consider_all_requests_local = true
|
config.consider_all_requests_local = true
|
||||||
|
|
||||||
|
# Enable server timing
|
||||||
|
config.server_timing = true
|
||||||
|
|
||||||
# Enable/disable caching. By default caching is disabled.
|
# Enable/disable caching. By default caching is disabled.
|
||||||
# Run rails dev:cache to toggle caching.
|
# Run rails dev:cache to toggle caching.
|
||||||
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
if Rails.root.join("tmp/caching-dev.txt").exist?
|
||||||
config.action_controller.perform_caching = true
|
config.action_controller.perform_caching = true
|
||||||
config.action_controller.enable_fragment_cache_logging = true
|
config.action_controller.enable_fragment_cache_logging = true
|
||||||
|
|
||||||
config.cache_store = :memory_store
|
config.cache_store = :memory_store
|
||||||
config.public_file_server.headers = {
|
config.public_file_server.headers = {
|
||||||
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
config.action_controller.perform_caching = false
|
config.action_controller.perform_caching = false
|
||||||
@ -36,6 +41,12 @@ Rails.application.configure do
|
|||||||
# Print deprecation notices to the Rails logger.
|
# Print deprecation notices to the Rails logger.
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Raise exceptions for disallowed deprecations.
|
||||||
|
config.active_support.disallowed_deprecation = :raise
|
||||||
|
|
||||||
|
# Tell Active Support which deprecation messages to disallow.
|
||||||
|
config.active_support.disallowed_deprecation_warnings = []
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations.
|
# Raise an error on page load if there are pending migrations.
|
||||||
config.active_record.migration_error = :page_load
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
@ -44,9 +55,11 @@ Rails.application.configure do
|
|||||||
|
|
||||||
|
|
||||||
# Raises error for missing translations.
|
# Raises error for missing translations.
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.i18n.raise_on_missing_translations = true
|
||||||
|
|
||||||
# Use an evented file watcher to asynchronously detect changes in source code,
|
# Annotate rendered view with file names.
|
||||||
# routes, locales, etc. This feature depends on the listen gem.
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
|
||||||
|
# Uncomment if you wish to allow Action Cable access from any origin.
|
||||||
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
@ -20,22 +22,25 @@ Rails.application.configure do
|
|||||||
|
|
||||||
# Disable serving static files from the `/public` folder by default since
|
# Disable serving static files from the `/public` folder by default since
|
||||||
# Apache or NGINX already handles this.
|
# Apache or NGINX already handles this.
|
||||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
# config.action_controller.asset_host = 'http://assets.example.com'
|
# config.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
# Specifies the header that your server uses for sending files.
|
# Specifies the header that your server uses for sending files.
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
||||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
||||||
|
|
||||||
config.action_cable.allowed_request_origins = [ /https?:\/\/parsley.elbert.us/ ]
|
# Mount Action Cable outside main process or domain.
|
||||||
|
# config.action_cable.mount_path = nil
|
||||||
|
# config.action_cable.url = "wss://example.com/cable"
|
||||||
|
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
||||||
|
|
||||||
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
# config.force_ssl = true
|
# config.force_ssl = true
|
||||||
|
|
||||||
# Use the lowest log level to ensure availability of diagnostic information
|
# Include generic and useful information about system operation, but avoid logging too much
|
||||||
# when problems arise.
|
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
||||||
config.log_level = :info
|
config.log_level = :info
|
||||||
|
|
||||||
# Prepend all log lines with the following tags.
|
# Prepend all log lines with the following tags.
|
||||||
@ -58,15 +63,15 @@ Rails.application.configure do
|
|||||||
# the I18n.default_locale when a translation cannot be found).
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
config.i18n.fallbacks = true
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
# Send deprecation notices to registered listeners.
|
# Don't log any deprecations.
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.report_deprecations = false
|
||||||
|
|
||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
config.log_formatter = ::Logger::Formatter.new
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
# Use a different logger for distributed setups.
|
# Use a different logger for distributed setups.
|
||||||
# require 'syslog/logger'
|
# require "syslog/logger"
|
||||||
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
||||||
|
|
||||||
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
||||||
logger = ActiveSupport::Logger.new(STDOUT)
|
logger = ActiveSupport::Logger.new(STDOUT)
|
||||||
@ -76,25 +81,4 @@ Rails.application.configure do
|
|||||||
|
|
||||||
# Do not dump schema after migrations.
|
# Do not dump schema after migrations.
|
||||||
config.active_record.dump_schema_after_migration = false
|
config.active_record.dump_schema_after_migration = false
|
||||||
|
|
||||||
# Inserts middleware to perform automatic connection switching.
|
|
||||||
# The `database_selector` hash is used to pass options to the DatabaseSelector
|
|
||||||
# middleware. The `delay` is used to determine how long to wait after a write
|
|
||||||
# to send a subsequent read to the primary.
|
|
||||||
#
|
|
||||||
# The `database_resolver` class is used by the middleware to determine which
|
|
||||||
# database is appropriate to use based on the time delay.
|
|
||||||
#
|
|
||||||
# The `database_resolver_context` class is used by the middleware to set
|
|
||||||
# timestamps for the last write to the primary. The resolver uses the context
|
|
||||||
# class timestamps to determine how long to wait before reading from the
|
|
||||||
# replica.
|
|
||||||
#
|
|
||||||
# By default Rails will store a last write timestamp in the session. The
|
|
||||||
# DatabaseSelector middleware is designed as such you can define your own
|
|
||||||
# strategy for connection switching and pass that into the middleware through
|
|
||||||
# these configuration options.
|
|
||||||
# config.active_record.database_selector = { delay: 2.seconds }
|
|
||||||
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
|
||||||
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
require "active_support/core_ext/integer/time"
|
||||||
|
|
||||||
# The test environment is used exclusively to run your application's
|
# The test environment is used exclusively to run your application's
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
# your test database is "scratch space" for the test suite and is wiped
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
@ -6,17 +8,18 @@
|
|||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# Turn false under Spring and add config.action_view.cache_template_loading = true.
|
||||||
config.cache_classes = true
|
config.cache_classes = true
|
||||||
|
|
||||||
# Do not eager load code on boot. This avoids loading your whole application
|
# Eager loading loads your whole application. When running a single test locally,
|
||||||
# just for the purpose of running a single test. If you are using a tool that
|
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
||||||
# preloads Rails for running tests, you may have to set it to true.
|
# system, or in some way before deploying your code.
|
||||||
config.eager_load = false
|
config.eager_load = ENV["CI"].present?
|
||||||
|
|
||||||
# Configure public file server for tests with Cache-Control for performance.
|
# Configure public file server for tests with Cache-Control for performance.
|
||||||
config.public_file_server.enabled = true
|
config.public_file_server.enabled = true
|
||||||
config.public_file_server.headers = {
|
config.public_file_server.headers = {
|
||||||
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
@ -40,6 +43,15 @@ Rails.application.configure do
|
|||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
# Raise exceptions for disallowed deprecations.
|
||||||
|
config.active_support.disallowed_deprecation = :raise
|
||||||
|
|
||||||
|
# Tell Active Support which deprecation messages to disallow.
|
||||||
|
config.active_support.disallowed_deprecation_warnings = []
|
||||||
|
|
||||||
# Raises error for missing translations.
|
# Raises error for missing translations.
|
||||||
# config.action_view.raise_on_missing_translations = true
|
# config.i18n.raise_on_missing_translations = true
|
||||||
|
|
||||||
|
# Annotate rendered view with file names.
|
||||||
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Version of your assets, change this if you want to expire all your assets.
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
# Rails.application.config.assets.version = '1.0'
|
# Rails.application.config.assets.version = "1.0"
|
||||||
|
|
||||||
# Add additional assets to the asset load path.
|
# Add additional assets to the asset load path.
|
||||||
# Rails.application.config.assets.paths << Emoji.images_path
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
@ -1,28 +1,25 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Define an application-wide content security policy
|
# Define an application-wide content security policy.
|
||||||
# For further information see the following documentation
|
# See the Securing Rails Applications Guide for more information:
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
||||||
|
|
||||||
# Rails.application.config.content_security_policy do |policy|
|
# Rails.application.configure do
|
||||||
|
# config.content_security_policy do |policy|
|
||||||
# policy.default_src :self, :https
|
# policy.default_src :self, :https
|
||||||
# policy.font_src :self, :https, :data
|
# policy.font_src :self, :https, :data
|
||||||
# policy.img_src :self, :https, :data
|
# policy.img_src :self, :https, :data
|
||||||
# policy.object_src :none
|
# policy.object_src :none
|
||||||
# policy.script_src :self, :https
|
# policy.script_src :self, :https
|
||||||
# policy.style_src :self, :https
|
# policy.style_src :self, :https
|
||||||
|
|
||||||
# # Specify URI for violation reports
|
# # Specify URI for violation reports
|
||||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||||
# end
|
# end
|
||||||
|
#
|
||||||
# If you are using UJS then enable automatic nonce generation
|
# # Generate session nonces for permitted importmap and inline scripts
|
||||||
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
||||||
|
# config.content_security_policy_nonce_directives = %w(script-src)
|
||||||
# Set the nonce only to specific directives
|
#
|
||||||
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
# # Report violations without enforcing the policy.
|
||||||
|
# # config.content_security_policy_report_only = true
|
||||||
# Report CSP violations to a specified URI
|
# end
|
||||||
# For further information see the following documentation:
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
|
||||||
# Rails.application.config.content_security_policy_report_only = true
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
# Configure sensitive parameters which will be filtered from the log file.
|
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
||||||
Rails.application.config.filter_parameters += [:password]
|
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
||||||
|
# notations and behaviors.
|
||||||
|
Rails.application.config.filter_parameters += [
|
||||||
|
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
||||||
|
]
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
# are locale specific, and you may define rules for as many different
|
# are locale specific, and you may define rules for as many different
|
||||||
# locales as you wish. All of these examples are active by default:
|
# locales as you wish. All of these examples are active by default:
|
||||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
# inflect.plural /^(ox)$/i, '\1en'
|
# inflect.plural /^(ox)$/i, "\\1en"
|
||||||
# inflect.singular /^(ox)en/i, '\1'
|
# inflect.singular /^(ox)en/i, "\\1"
|
||||||
# inflect.irregular 'person', 'people'
|
# inflect.irregular "person", "people"
|
||||||
# inflect.uncountable %w( fish sheep )
|
# inflect.uncountable %w( fish sheep )
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# These inflection rules are supported but not enabled by default:
|
# These inflection rules are supported but not enabled by default:
|
||||||
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
# inflect.acronym 'RESTful'
|
# inflect.acronym "RESTful"
|
||||||
# end
|
# end
|
||||||
|
|
||||||
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
135
config/initializers/new_framework_defaults_7_0.rb
Normal file
135
config/initializers/new_framework_defaults_7_0.rb
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file eases your Rails 7.0 framework defaults upgrade.
|
||||||
|
#
|
||||||
|
# Uncomment each configuration one by one to switch to the new default.
|
||||||
|
# Once your application is ready to run with all new defaults, you can remove
|
||||||
|
# this file and set the `config.load_defaults` to `7.0`.
|
||||||
|
#
|
||||||
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
|
||||||
|
|
||||||
|
# `button_to` view helper will render `<button>` element, regardless of whether
|
||||||
|
# or not the content is passed as the first argument or as a block.
|
||||||
|
# Rails.application.config.action_view.button_to_generates_button_tag = true
|
||||||
|
|
||||||
|
# `stylesheet_link_tag` view helper will not render the media attribute by default.
|
||||||
|
# Rails.application.config.action_view.apply_stylesheet_media_default = false
|
||||||
|
|
||||||
|
# Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
|
||||||
|
# Changing this default means invalidate all encrypted messages generated by
|
||||||
|
# your application and, all the encrypted cookies. Only change this after you
|
||||||
|
# rotated all the messages using the key rotator.
|
||||||
|
#
|
||||||
|
# See upgrading guide for more information on how to build a rotator.
|
||||||
|
# https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
|
||||||
|
# Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
|
||||||
|
|
||||||
|
# Change the digest class for ActiveSupport::Digest.
|
||||||
|
# Changing this default means that for example Etags change and
|
||||||
|
# various cache keys leading to cache invalidation.
|
||||||
|
# Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
|
||||||
|
|
||||||
|
# Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
|
||||||
|
# implementation.
|
||||||
|
# Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
|
||||||
|
|
||||||
|
# Calls `Rails.application.executor.wrap` around test cases.
|
||||||
|
# This makes test cases behave closer to an actual request or job.
|
||||||
|
# Several features that are normally disabled in test, such as Active Record query cache
|
||||||
|
# and asynchronous queries will then be enabled.
|
||||||
|
# Rails.application.config.active_support.executor_around_test_case = true
|
||||||
|
|
||||||
|
# Define the isolation level of most of Rails internal state.
|
||||||
|
# If you use a fiber based server or job processor, you should set it to `:fiber`.
|
||||||
|
# Otherwise the default of `:thread` if preferable.
|
||||||
|
# Rails.application.config.active_support.isolation_level = :thread
|
||||||
|
|
||||||
|
# Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
|
||||||
|
# Rails.application.config.action_mailer.smtp_timeout = 5
|
||||||
|
|
||||||
|
# The ActiveStorage video previewer will now use scene change detection to generate
|
||||||
|
# better preview images (rather than the previous default of using the first frame
|
||||||
|
# of the video).
|
||||||
|
# Rails.application.config.active_storage.video_preview_arguments =
|
||||||
|
# "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
|
||||||
|
|
||||||
|
# Automatically infer `inverse_of` for associations with a scope.
|
||||||
|
# Rails.application.config.active_record.automatic_scope_inversing = true
|
||||||
|
|
||||||
|
# Raise when running tests if fixtures contained foreign key violations
|
||||||
|
# Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
|
||||||
|
|
||||||
|
# Disable partial inserts.
|
||||||
|
# This default means that all columns will be referenced in INSERT queries
|
||||||
|
# regardless of whether they have a default or not.
|
||||||
|
# Rails.application.config.active_record.partial_inserts = false
|
||||||
|
|
||||||
|
# Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
|
||||||
|
# Rails.application.config.action_controller.raise_on_open_redirects = true
|
||||||
|
|
||||||
|
# Change the variant processor for Active Storage.
|
||||||
|
# Changing this default means updating all places in your code that
|
||||||
|
# generate variants to use image processing macros and ruby-vips
|
||||||
|
# operations. See the upgrading guide for detail on the changes required.
|
||||||
|
# The `:mini_magick` option is not deprecated; it's fine to keep using it.
|
||||||
|
# Rails.application.config.active_storage.variant_processor = :vips
|
||||||
|
|
||||||
|
# Enable parameter wrapping for JSON.
|
||||||
|
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
|
||||||
|
# To disable parameter wrapping entirely, set this config to `false`.
|
||||||
|
# Rails.application.config.action_controller.wrap_parameters_by_default = true
|
||||||
|
|
||||||
|
# Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
|
||||||
|
# `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
|
||||||
|
#
|
||||||
|
# See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
|
||||||
|
# more information.
|
||||||
|
# Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
|
||||||
|
|
||||||
|
# Change the default headers to disable browsers' flawed legacy XSS protection.
|
||||||
|
# Rails.application.config.action_dispatch.default_headers = {
|
||||||
|
# "X-Frame-Options" => "SAMEORIGIN",
|
||||||
|
# "X-XSS-Protection" => "0",
|
||||||
|
# "X-Content-Type-Options" => "nosniff",
|
||||||
|
# "X-Download-Options" => "noopen",
|
||||||
|
# "X-Permitted-Cross-Domain-Policies" => "none",
|
||||||
|
# "Referrer-Policy" => "strict-origin-when-cross-origin"
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
# ** Please read carefully, this must be configured in config/application.rb **
|
||||||
|
# Change the format of the cache entry.
|
||||||
|
# Changing this default means that all new cache entries added to the cache
|
||||||
|
# will have a different format that is not supported by Rails 6.1 applications.
|
||||||
|
# Only change this value after your application is fully deployed to Rails 7.0
|
||||||
|
# and you have no plans to rollback.
|
||||||
|
# When you're ready to change format, add this to `config/application.rb` (NOT this file):
|
||||||
|
# config.active_support.cache_format_version = 7.0
|
||||||
|
|
||||||
|
|
||||||
|
# Cookie serializer: 2 options
|
||||||
|
#
|
||||||
|
# If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
|
||||||
|
# is `:marshal`. The default for new apps is `:json`.
|
||||||
|
#
|
||||||
|
# Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
|
||||||
|
#
|
||||||
|
# Rails transparently deserializes existing (Marshal-serialized) cookies on read and
|
||||||
|
# re-writes them in the JSON format.
|
||||||
|
#
|
||||||
|
# It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
|
||||||
|
# have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
|
||||||
|
# initializer or to `config/application.rb`.
|
||||||
|
#
|
||||||
|
# Rails.application.config.action_dispatch.cookies_serializer = :hybrid
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
|
||||||
|
#
|
||||||
|
# If you have configured the serializer elsewhere, you can remove this section of the file.
|
||||||
|
#
|
||||||
|
# See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
|
11
config/initializers/permissions_policy.rb
Normal file
11
config/initializers/permissions_policy.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Define an application-wide HTTP permissions policy. For further
|
||||||
|
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
||||||
|
#
|
||||||
|
# Rails.application.config.permissions_policy do |f|
|
||||||
|
# f.camera :none
|
||||||
|
# f.gyroscope :none
|
||||||
|
# f.microphone :none
|
||||||
|
# f.usb :none
|
||||||
|
# f.fullscreen :self
|
||||||
|
# f.payment :self, "https://secure.example.com"
|
||||||
|
# end
|
57
db/schema.rb
57
db/schema.rb
@ -2,16 +2,15 @@
|
|||||||
# of editing this file, please use the migrations feature of Active Record to
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
# incrementally modify your database, and then regenerate this schema definition.
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
#
|
#
|
||||||
# This file is the source Rails uses to define your schema when running `rails
|
# This file is the source Rails uses to define your schema when running `bin/rails
|
||||||
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
|
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
||||||
# be faster and is potentially less error prone than running all of your
|
# be faster and is potentially less error prone than running all of your
|
||||||
# migrations from scratch. Old migrations may fail to apply correctly if those
|
# migrations from scratch. Old migrations may fail to apply correctly if those
|
||||||
# migrations use external dependencies or application code.
|
# migrations use external dependencies or application code.
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
ActiveRecord::Schema[7.0].define(version: 2018_09_15_134841) do
|
||||||
|
|
||||||
create_table "food_units", force: :cascade do |t|
|
create_table "food_units", force: :cascade do |t|
|
||||||
t.integer "food_id", null: false
|
t.integer "food_id", null: false
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
@ -23,8 +22,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "density"
|
t.string "density"
|
||||||
t.text "notes"
|
t.text "notes"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.string "ndbn", limit: 25
|
t.string "ndbn", limit: 25
|
||||||
t.decimal "water", precision: 10, scale: 2
|
t.decimal "water", precision: 10, scale: 2
|
||||||
t.decimal "protein", precision: 10, scale: 2
|
t.decimal "protein", precision: 10, scale: 2
|
||||||
@ -59,18 +58,18 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "recipe_id"
|
t.integer "recipe_id"
|
||||||
t.integer "source_recipe_id"
|
t.integer "source_recipe_id"
|
||||||
t.datetime "date"
|
t.datetime "date", precision: nil
|
||||||
t.integer "rating"
|
t.integer "rating"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.text "notes"
|
t.text "notes"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "notes", force: :cascade do |t|
|
create_table "notes", force: :cascade do |t|
|
||||||
t.integer "user_id", null: false
|
t.integer "user_id", null: false
|
||||||
t.text "content", null: false
|
t.text "content", null: false
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.index ["user_id"], name: "index_notes_on_user_id"
|
t.index ["user_id"], name: "index_notes_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -81,8 +80,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.integer "sort_order"
|
t.integer "sort_order"
|
||||||
t.string "quantity"
|
t.string "quantity"
|
||||||
t.string "units"
|
t.string "units"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.text "preparation"
|
t.text "preparation"
|
||||||
t.integer "recipe_as_ingredient_id"
|
t.integer "recipe_as_ingredient_id"
|
||||||
t.index ["recipe_id"], name: "index_recipe_ingredients_on_recipe_id"
|
t.index ["recipe_id"], name: "index_recipe_ingredients_on_recipe_id"
|
||||||
@ -92,8 +91,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.integer "recipe_id"
|
t.integer "recipe_id"
|
||||||
t.integer "sort_order"
|
t.integer "sort_order"
|
||||||
t.text "step"
|
t.text "step"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.index ["recipe_id"], name: "index_recipe_steps_on_recipe_id"
|
t.index ["recipe_id"], name: "index_recipe_steps_on_recipe_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -104,8 +103,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.string "yields"
|
t.string "yields"
|
||||||
t.integer "total_time"
|
t.integer "total_time"
|
||||||
t.integer "active_time"
|
t.integer "active_time"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.boolean "deleted"
|
t.boolean "deleted"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.boolean "is_log"
|
t.boolean "is_log"
|
||||||
@ -124,8 +123,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
create_table "tags", force: :cascade do |t|
|
create_table "tags", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "lowercase_name"
|
t.string "lowercase_name"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.index ["lowercase_name"], name: "index_tags_on_lowercase_name", unique: true
|
t.index ["lowercase_name"], name: "index_tags_on_lowercase_name", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,8 +132,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.integer "task_list_id", null: false
|
t.integer "task_list_id", null: false
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "quantity"
|
t.string "quantity"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.boolean "completed"
|
t.boolean "completed"
|
||||||
t.index ["task_list_id"], name: "index_task_items_on_task_list_id"
|
t.index ["task_list_id"], name: "index_task_items_on_task_list_id"
|
||||||
end
|
end
|
||||||
@ -142,8 +141,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
create_table "task_lists", force: :cascade do |t|
|
create_table "task_lists", force: :cascade do |t|
|
||||||
t.integer "user_id", null: false
|
t.integer "user_id", null: false
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.index ["user_id"], name: "index_task_lists_on_user_id"
|
t.index ["user_id"], name: "index_task_lists_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -152,8 +151,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.decimal "amount", precision: 7, scale: 3
|
t.decimal "amount", precision: 7, scale: 3
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.decimal "gram_weight", precision: 7, scale: 1
|
t.decimal "gram_weight", precision: 7, scale: 1
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.index ["usda_food_id"], name: "index_usda_food_weights_on_usda_food_id"
|
t.index ["usda_food_id"], name: "index_usda_food_weights_on_usda_food_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -176,8 +175,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.string "refuse_description"
|
t.string "refuse_description"
|
||||||
t.integer "refuse_percent"
|
t.integer "refuse_percent"
|
||||||
t.string "scientific_name"
|
t.string "scientific_name"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
t.integer "calcium"
|
t.integer "calcium"
|
||||||
t.decimal "iron", precision: 10, scale: 2
|
t.decimal "iron", precision: 10, scale: 2
|
||||||
t.integer "magnesium"
|
t.integer "magnesium"
|
||||||
@ -209,8 +208,8 @@ ActiveRecord::Schema.define(version: 2018_09_15_134841) do
|
|||||||
t.string "full_name"
|
t.string "full_name"
|
||||||
t.string "password_digest"
|
t.string "password_digest"
|
||||||
t.boolean "admin"
|
t.boolean "admin"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", precision: nil, null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", precision: nil, null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rails/actioncable": "^6.1.4",
|
"@rails/actioncable": "^7.0.4",
|
||||||
"@rails/webpacker": "5.4.3",
|
"@rails/webpacker": "5.4.3",
|
||||||
"@tweenjs/tween.js": "^18.6.4",
|
"@tweenjs/tween.js": "^18.6.4",
|
||||||
"autosize": "^4.0.2",
|
"autosize": "^4.0.2",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
require 'usda_importer'
|
require 'usda_importer'
|
||||||
|
|
||||||
RSpec.describe UsdaImporter do
|
RSpec.describe UsdaImporter, :skip_db_cleaner do
|
||||||
|
|
||||||
it 'imports' do
|
it 'imports' do
|
||||||
i = UsdaImporter.new(Rails.root.join('spec', 'test_data'))
|
i = UsdaImporter.new(Rails.root.join('spec', 'test_data'))
|
||||||
|
@ -44,10 +44,14 @@ RSpec.configure do |config|
|
|||||||
end
|
end
|
||||||
|
|
||||||
config.around(:each) do |example|
|
config.around(:each) do |example|
|
||||||
|
if example.metadata[:skip_db_cleaner]
|
||||||
|
example.run
|
||||||
|
else
|
||||||
DatabaseCleaner.cleaning do
|
DatabaseCleaner.cleaning do
|
||||||
example.run
|
example.run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# RSpec Rails can automatically mix in different behaviours to your tests
|
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||||
# based on their file location, for example enabling you to call `get` and
|
# based on their file location, for example enabling you to call `get` and
|
||||||
|
Loading…
Reference in New Issue
Block a user