diff --git a/Rakefile b/Rakefile
index 7e5e8eed3..22553c357 100755
--- a/Rakefile
+++ b/Rakefile
@@ -5,4 +5,4 @@
require 'rake/dsl_definition'
require File.expand_path('../config/application', __FILE__)
-Growstuff::Application.load_tasks
+Rails.application.load_tasks
diff --git a/app/assets/javascripts/crops.js.erb b/app/assets/javascripts/crops.js.erb
index afa16a009..f2eec8848 100644
--- a/app/assets/javascripts/crops.js.erb
+++ b/app/assets/javascripts/crops.js.erb
@@ -1,8 +1,8 @@
//= require graphs/horizontal_bar_graph
if (document.getElementById("cropmap") !== null) {
- mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_map_id %>";
- mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_access_token %>";
+ mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
+ mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
mapbox_base_url = "http://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
L.Icon.Default.imagePath = '/assets'
diff --git a/app/assets/javascripts/members.js.erb b/app/assets/javascripts/members.js.erb
index 500e79b25..1a3158f52 100644
--- a/app/assets/javascripts/members.js.erb
+++ b/app/assets/javascripts/members.js.erb
@@ -1,6 +1,6 @@
if (document.getElementById("membermap") !== null) {
- mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_map_id %>";
- mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_access_token %>";
+ mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
+ mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
mapbox_base_url = "http://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
L.Icon.Default.imagePath = '/assets'
diff --git a/app/assets/javascripts/places.js.erb b/app/assets/javascripts/places.js.erb
index 48cb960d7..ad8b76266 100644
--- a/app/assets/javascripts/places.js.erb
+++ b/app/assets/javascripts/places.js.erb
@@ -1,10 +1,10 @@
if (document.getElementById("placesmap") !== null) {
places_base_path = "/places";
- mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_map_id %>";
- mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.mapbox_access_token %>";
+ mapbox_map_id = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_map_id %>";
+ mapbox_access_token = "<%= Rails.env == 'test' ? 0 : Rails.application.config.mapbox_access_token %>";
mapbox_base_url = "http://a.tiles.mapbox.com/v4/" + mapbox_map_id + "/{z}/{x}/{y}.png?access_token=" + mapbox_access_token;
nominatim_base_url = 'http://nominatim.openstreetmap.org/search/';
- nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Growstuff::Application.config.user_agent_email %>";
+ nominatim_user_agent_email = "<%= Rails.env == 'test' ? 0 : Rails.application.config.user_agent_email %>";
L.Icon.Default.imagePath = '/assets'
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb
index 3bc9fe45c..31c709148 100644
--- a/app/controllers/orders_controller.rb
+++ b/app/controllers/orders_controller.rb
@@ -34,7 +34,7 @@ class OrdersController < ApplicationController
response = EXPRESS_GATEWAY.setup_purchase(
@order.total,
items: @order.activemerchant_items,
- currency: Growstuff::Application.config.currency,
+ currency: Rails.application.config.currency,
no_shipping: true,
ip: request.remote_ip,
return_url: complete_order_url,
@@ -51,7 +51,7 @@ class OrdersController < ApplicationController
if params[:token] && params['PayerID']
purchase = EXPRESS_GATEWAY.purchase(
@order.total,
- currency: Growstuff::Application.config.currency,
+ currency: Rails.application.config.currency,
ip: request.remote_ip,
payer_id: params['PayerID'],
token: params[:token]
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 639d27686..4e010cef1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -5,7 +5,7 @@ module ApplicationHelper
# 999 cents becomes 9.99 AUD -- for products/orders/etc
def price_with_currency(price)
- format('%.2f %s', price / 100.0, Growstuff::Application.config.currency)
+ format('%.2f %s', price / 100.0, Rails.application.config.currency)
end
def parse_date(str)
@@ -15,7 +15,7 @@ module ApplicationHelper
def forex_link(price)
pid = price_in_dollars(price)
- currency = Growstuff::Application.config.currency
+ currency = Rails.application.config.currency
link = "http://www.wolframalpha.com/input/?i=#{pid}+#{currency}"
link_to "(convert)", link, target: "_blank", rel: "noopener noreferrer"
diff --git a/app/models/account.rb b/app/models/account.rb
index 646e9db78..be14f406a 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -9,7 +9,7 @@ class Account < ActiveRecord::Base
before_create do |account|
unless account.account_type
account.account_type = AccountType.find_or_create_by(name:
- Growstuff::Application.config.default_account_type)
+ Rails.application.config.default_account_type)
end
end
diff --git a/app/models/member.rb b/app/models/member.rb
index 9828a005c..80a5ba840 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -210,7 +210,7 @@ class Member < ActiveRecord::Base
def newsletter_subscribe(gb = Gibbon::API.new, testing = false)
return true if Rails.env.test? && !testing
gb.lists.subscribe(
- id: Growstuff::Application.config.newsletter_list_id,
+ id: Rails.application.config.newsletter_list_id,
email: { email: email },
merge_vars: { login_name: login_name },
double_optin: false # they already confirmed their email with us
@@ -219,7 +219,7 @@ class Member < ActiveRecord::Base
def newsletter_unsubscribe(gb = Gibbon::API.new, testing = false)
return true if Rails.env.test? && !testing
- gb.lists.unsubscribe(id: Growstuff::Application.config.newsletter_list_id,
+ gb.lists.unsubscribe(id: Rails.application.config.newsletter_list_id,
email: { email: email })
end
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 7fe945d8a..d7e05a282 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -28,4 +28,4 @@
/ Placed at the end of the document so the pages load faster
= javascript_include_tag "application"
- != Growstuff::Application.config.analytics_code
+ != Rails.application.config.analytics_code
diff --git a/bin/rails b/bin/rails
index 5191e6927..073966023 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,4 +1,4 @@
#!/usr/bin/env ruby
-APP_PATH = File.expand_path('../../config/application', __FILE__)
+APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 000000000..78c4e861d
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a starting point to setup your application.
+ # Add necessary setup steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ # Install JavaScript dependencies if using Yarn
+ # system('bin/yarn')
+
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/bin/update b/bin/update
new file mode 100755
index 000000000..a8e4462f2
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
diff --git a/bin/yarn b/bin/yarn
new file mode 100755
index 000000000..c2bacef83
--- /dev/null
+++ b/bin/yarn
@@ -0,0 +1,11 @@
+#!/usr/bin/env ruby
+VENDOR_PATH = File.expand_path('..', __dir__)
+Dir.chdir(VENDOR_PATH) do
+ begin
+ exec "yarnpkg #{ARGV.join(" ")}"
+ rescue Errno::ENOENT
+ $stderr.puts "Yarn executable was not detected in the system."
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
+ exit 1
+ end
+end
diff --git a/config.ru b/config.ru
index d30ee4f18..bd83b2541 100644
--- a/config.ru
+++ b/config.ru
@@ -1,4 +1,4 @@
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
-run Growstuff::Application
+run Rails.application
diff --git a/config/boot.rb b/config/boot.rb
index f2830ae31..30f5120df 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,6 +1,3 @@
-require 'rubygems'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
-# Set up gems listed in the Gemfile.
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-
-require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/config/cable.yml b/config/cable.yml
new file mode 100644
index 000000000..b6110a25b
--- /dev/null
+++ b/config/cable.yml
@@ -0,0 +1,10 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
+ channel_prefix: growstuff_production
diff --git a/config/environment.rb b/config/environment.rb
index b175f6a30..426333bb4 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,5 +1,5 @@
-# Load the rails application
-require File.expand_path('../application', __FILE__)
+# Load the Rails application.
+require_relative 'application'
-# Initialize the rails application
-Growstuff::Application.initialize!
+# Initialize the Rails application.
+Rails.application.initialize!
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
new file mode 100644
index 000000000..89d2efab2
--- /dev/null
+++ b/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+# ActiveSupport::Reloader.to_prepare do
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
+# end
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
new file mode 100644
index 000000000..4b828e80c
--- /dev/null
+++ b/config/initializers/assets.rb
@@ -0,0 +1,14 @@
+# 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.
+Rails.application.config.assets.version = '1.0'
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
+# Add Yarn node_modules folder to the asset load path.
+Rails.application.config.assets.paths << Rails.root.join('node_modules')
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w( admin.js admin.css )
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
new file mode 100644
index 000000000..1389e86a3
--- /dev/null
+++ b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
new file mode 100644
index 000000000..4a994e1e7
--- /dev/null
+++ b/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password]
diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb
index afe41f574..b31f1edf3 100644
--- a/config/initializers/geocoder.rb
+++ b/config/initializers/geocoder.rb
@@ -5,8 +5,8 @@ Geocoder.configure(
timeout: 10,
http_headers: {
"User-Agent" =>
- "#{Growstuff::Application.config.user_agent} #{Growstuff::Application.config.user_agent_email}",
- "From" => Growstuff::Application.config.user_agent_email
+ "#{Rails.application.config.user_agent} #{Rails.application.config.user_agent_email}",
+ "From" => Rails.application.config.user_agent_email
}
)
# This configuration takes precedence over environment/test.rb
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index 599d85bf4..22df44c07 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -1,16 +1,17 @@
# Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format
-# (all these examples are active by default):
-# ActiveSupport::Inflector.inflections do |inflect|
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
-#
+
# These inflection rules are supported but not enabled by default:
-# ActiveSupport::Inflector.inflections do |inflect|
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 72aca7e44..dc1899682 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb
new file mode 100644
index 000000000..9010abd5c
--- /dev/null
+++ b/config/initializers/new_framework_defaults_5_1.rb
@@ -0,0 +1,14 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.1 upgrade.
+#
+# Once upgraded flip defaults one by one to migrate to the new default.
+#
+# Read the Guide for Upgrading Ruby on Rails for more info on each option.
+
+# Make `form_with` generate non-remote forms.
+Rails.application.config.action_view.form_with_generates_remote_forms = false
+
+# Unknown asset fallback will return the path passed in when the given
+# asset is not present in the asset pipeline.
+# Rails.application.config.assets.unknown_asset_fallback = false
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 25119c9bc..9fc739015 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file.
-Growstuff::Application.config.session_store :cookie_store, key: '_growstuff_session'
+Rails.application.config.session_store :cookie_store, key: '_growstuff_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
-# Growstuff::Application.config.session_store :active_record_store
+# Rails.application.config.session_store :active_record_store
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index 999df2018..bbfc3961b 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -1,5 +1,5 @@
# Be sure to restart your server when you modify this file.
-#
+
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
@@ -8,7 +8,7 @@ ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
-# Disable root element in JSON by default.
-ActiveSupport.on_load(:active_record) do
- self.include_root_in_json = false
-end
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
diff --git a/config/puma.rb b/config/puma.rb
new file mode 100644
index 000000000..1e19380dc
--- /dev/null
+++ b/config/puma.rb
@@ -0,0 +1,56 @@
+# Puma can serve each request in a thread from an internal thread pool.
+# The `threads` method setting takes two numbers: a minimum and maximum.
+# Any libraries that use thread pools should be configured to match
+# the maximum value specified for Puma. Default is set to 5 threads for minimum
+# and maximum; this matches the default thread size of Active Record.
+#
+threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+#
+port ENV.fetch("PORT") { 3000 }
+
+# Specifies the `environment` that Puma will run in.
+#
+environment ENV.fetch("RAILS_ENV") { "development" }
+
+# Specifies the number of `workers` to boot in clustered mode.
+# Workers are forked webserver processes. If using threads and workers together
+# the concurrency of the application would be max `threads` * `workers`.
+# Workers do not work on JRuby or Windows (both of which do not support
+# processes).
+#
+# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
+
+# Use the `preload_app!` method when specifying a `workers` number.
+# This directive tells Puma to first boot the application and load code
+# before forking the application. This takes advantage of Copy On Write
+# process behavior so workers use less memory. If you use this option
+# you need to make sure to reconnect any threads in the `on_worker_boot`
+# block.
+#
+# preload_app!
+
+# If you are preloading your application and using Active Record, it's
+# recommended that you close any connections to the database before workers
+# are forked to prevent connection leakage.
+#
+# before_fork do
+# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
+# end
+
+# The code in the `on_worker_boot` will be called if you are using
+# clustered mode by specifying a number of `workers`. After each worker
+# process is booted, this block will be run. If you are using the `preload_app!`
+# option, you will want to use this block to reconnect to any threads
+# or connections that may have been created at application boot, as Ruby
+# cannot share connections between processes.
+#
+# on_worker_boot do
+# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
+# end
+#
+
+# Allow puma to be restarted by `rails restart` command.
+plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
index eb963311a..013fee209 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,4 +1,4 @@
-Growstuff::Application.routes.draw do
+Rails.application.routes.draw do
get '/robots.txt' => 'robots#robots'
resources :plant_parts
@@ -89,7 +89,7 @@ Growstuff::Application.routes.draw do
get '/shop' => 'shop#index'
get '/shop/:action' => 'shop#:action'
- comfy_route :cms_admin, path: '/admin/cms'
+ # comfy_route :cms_admin, path: '/admin/cms'
namespace :admin do
resources :members
end
@@ -113,5 +113,5 @@ Growstuff::Application.routes.draw do
get '/.well-known/acme-challenge/:id' => 'pages#letsencrypt'
# CMS stuff -- must remain LAST
- comfy_route :cms, path: '/', sitemap: false
+ # comfy_route :cms, path: '/', sitemap: false
end
diff --git a/config/spring.rb b/config/spring.rb
new file mode 100644
index 000000000..c9119b40c
--- /dev/null
+++ b/config/spring.rb
@@ -0,0 +1,6 @@
+%w(
+ .ruby-version
+ .rbenv-vars
+ tmp/restart.txt
+ tmp/caching-dev.txt
+).each { |path| Spring.watch(path) }
diff --git a/db/schema.rb b/db/schema.rb
index 473e756fa..ea66548f1 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@@ -11,371 +10,352 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20171129041341) do
+ActiveRecord::Schema.define(version: 20180103024400) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
- create_table "account_types", force: :cascade do |t|
- t.string "name", null: false
- t.boolean "is_paid"
- t.boolean "is_permanent_paid"
+ create_table "account_types", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.boolean "is_paid"
+ t.boolean "is_permanent_paid"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "accounts", force: :cascade do |t|
- t.integer "member_id", null: false
- t.integer "account_type_id"
+ create_table "accounts", id: :serial, force: :cascade do |t|
+ t.integer "member_id", null: false
+ t.integer "account_type_id"
t.datetime "paid_until"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "alternate_names", force: :cascade do |t|
- t.string "name", null: false
- t.integer "crop_id", null: false
- t.integer "creator_id", null: false
+ create_table "alternate_names", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.integer "crop_id", null: false
+ t.integer "creator_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "authentications", force: :cascade do |t|
- t.integer "member_id", null: false
- t.string "provider", null: false
- t.string "uid"
- t.string "token"
- t.string "secret"
+ create_table "authentications", id: :serial, force: :cascade do |t|
+ t.integer "member_id", null: false
+ t.string "provider", null: false
+ t.string "uid"
+ t.string "token"
+ t.string "secret"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "name"
+ t.string "name"
+ t.index ["member_id"], name: "index_authentications_on_member_id"
end
- add_index "authentications", ["member_id"], name: "index_authentications_on_member_id", using: :btree
-
- create_table "comfy_cms_blocks", force: :cascade do |t|
- t.string "identifier", null: false
- t.text "content"
- t.integer "blockable_id"
- t.string "blockable_type"
+ create_table "comfy_cms_blocks", id: :serial, force: :cascade do |t|
+ t.string "identifier", null: false
+ t.text "content"
+ t.integer "blockable_id"
+ t.string "blockable_type"
t.datetime "created_at"
t.datetime "updated_at"
+ t.index ["blockable_id", "blockable_type"], name: "index_comfy_cms_blocks_on_blockable_id_and_blockable_type"
+ t.index ["identifier"], name: "index_comfy_cms_blocks_on_identifier"
end
- add_index "comfy_cms_blocks", ["blockable_id", "blockable_type"], name: "index_comfy_cms_blocks_on_blockable_id_and_blockable_type", using: :btree
- add_index "comfy_cms_blocks", ["identifier"], name: "index_comfy_cms_blocks_on_identifier", using: :btree
-
- create_table "comfy_cms_categories", force: :cascade do |t|
- t.integer "site_id", null: false
- t.string "label", null: false
- t.string "categorized_type", null: false
+ create_table "comfy_cms_categories", id: :serial, force: :cascade do |t|
+ t.integer "site_id", null: false
+ t.string "label", null: false
+ t.string "categorized_type", null: false
+ t.index ["site_id", "categorized_type", "label"], name: "index_cms_categories_on_site_id_and_cat_type_and_label", unique: true
end
- add_index "comfy_cms_categories", ["site_id", "categorized_type", "label"], name: "index_cms_categories_on_site_id_and_cat_type_and_label", unique: true, using: :btree
-
- create_table "comfy_cms_categorizations", force: :cascade do |t|
- t.integer "category_id", null: false
- t.string "categorized_type", null: false
- t.integer "categorized_id", null: false
+ create_table "comfy_cms_categorizations", id: :serial, force: :cascade do |t|
+ t.integer "category_id", null: false
+ t.string "categorized_type", null: false
+ t.integer "categorized_id", null: false
+ t.index ["category_id", "categorized_type", "categorized_id"], name: "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id", unique: true
end
- add_index "comfy_cms_categorizations", ["category_id", "categorized_type", "categorized_id"], name: "index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id", unique: true, using: :btree
-
- create_table "comfy_cms_files", force: :cascade do |t|
- t.integer "site_id", null: false
- t.integer "block_id"
- t.string "label", null: false
- t.string "file_file_name", null: false
- t.string "file_content_type", null: false
- t.integer "file_file_size", null: false
- t.string "description", limit: 2048
- t.integer "position", default: 0, null: false
+ create_table "comfy_cms_files", id: :serial, force: :cascade do |t|
+ t.integer "site_id", null: false
+ t.integer "block_id"
+ t.string "label", null: false
+ t.string "file_file_name", null: false
+ t.string "file_content_type", null: false
+ t.integer "file_file_size", null: false
+ t.string "description", limit: 2048
+ t.integer "position", default: 0, null: false
t.datetime "created_at"
t.datetime "updated_at"
+ t.index ["site_id", "block_id"], name: "index_comfy_cms_files_on_site_id_and_block_id"
+ t.index ["site_id", "file_file_name"], name: "index_comfy_cms_files_on_site_id_and_file_file_name"
+ t.index ["site_id", "label"], name: "index_comfy_cms_files_on_site_id_and_label"
+ t.index ["site_id", "position"], name: "index_comfy_cms_files_on_site_id_and_position"
end
- add_index "comfy_cms_files", ["site_id", "block_id"], name: "index_comfy_cms_files_on_site_id_and_block_id", using: :btree
- add_index "comfy_cms_files", ["site_id", "file_file_name"], name: "index_comfy_cms_files_on_site_id_and_file_file_name", using: :btree
- add_index "comfy_cms_files", ["site_id", "label"], name: "index_comfy_cms_files_on_site_id_and_label", using: :btree
- add_index "comfy_cms_files", ["site_id", "position"], name: "index_comfy_cms_files_on_site_id_and_position", using: :btree
-
- create_table "comfy_cms_layouts", force: :cascade do |t|
- t.integer "site_id", null: false
- t.integer "parent_id"
- t.string "app_layout"
- t.string "label", null: false
- t.string "identifier", null: false
- t.text "content"
- t.text "css"
- t.text "js"
- t.integer "position", default: 0, null: false
- t.boolean "is_shared", default: false, null: false
+ create_table "comfy_cms_layouts", id: :serial, force: :cascade do |t|
+ t.integer "site_id", null: false
+ t.integer "parent_id"
+ t.string "app_layout"
+ t.string "label", null: false
+ t.string "identifier", null: false
+ t.text "content"
+ t.text "css"
+ t.text "js"
+ t.integer "position", default: 0, null: false
+ t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
+ t.index ["parent_id", "position"], name: "index_comfy_cms_layouts_on_parent_id_and_position"
+ t.index ["site_id", "identifier"], name: "index_comfy_cms_layouts_on_site_id_and_identifier", unique: true
end
- add_index "comfy_cms_layouts", ["parent_id", "position"], name: "index_comfy_cms_layouts_on_parent_id_and_position", using: :btree
- add_index "comfy_cms_layouts", ["site_id", "identifier"], name: "index_comfy_cms_layouts_on_site_id_and_identifier", unique: true, using: :btree
-
- create_table "comfy_cms_pages", force: :cascade do |t|
- t.integer "site_id", null: false
- t.integer "layout_id"
- t.integer "parent_id"
- t.integer "target_page_id"
- t.string "label", null: false
- t.string "slug"
- t.string "full_path", null: false
- t.text "content_cache"
- t.integer "position", default: 0, null: false
- t.integer "children_count", default: 0, null: false
- t.boolean "is_published", default: true, null: false
- t.boolean "is_shared", default: false, null: false
+ create_table "comfy_cms_pages", id: :serial, force: :cascade do |t|
+ t.integer "site_id", null: false
+ t.integer "layout_id"
+ t.integer "parent_id"
+ t.integer "target_page_id"
+ t.string "label", null: false
+ t.string "slug"
+ t.string "full_path", null: false
+ t.text "content_cache"
+ t.integer "position", default: 0, null: false
+ t.integer "children_count", default: 0, null: false
+ t.boolean "is_published", default: true, null: false
+ t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
+ t.index ["parent_id", "position"], name: "index_comfy_cms_pages_on_parent_id_and_position"
+ t.index ["site_id", "full_path"], name: "index_comfy_cms_pages_on_site_id_and_full_path"
end
- add_index "comfy_cms_pages", ["parent_id", "position"], name: "index_comfy_cms_pages_on_parent_id_and_position", using: :btree
- add_index "comfy_cms_pages", ["site_id", "full_path"], name: "index_comfy_cms_pages_on_site_id_and_full_path", using: :btree
-
- create_table "comfy_cms_revisions", force: :cascade do |t|
- t.string "record_type", null: false
- t.integer "record_id", null: false
- t.text "data"
+ create_table "comfy_cms_revisions", id: :serial, force: :cascade do |t|
+ t.string "record_type", null: false
+ t.integer "record_id", null: false
+ t.text "data"
t.datetime "created_at"
+ t.index ["record_type", "record_id", "created_at"], name: "index_cms_revisions_on_rtype_and_rid_and_created_at"
end
- add_index "comfy_cms_revisions", ["record_type", "record_id", "created_at"], name: "index_cms_revisions_on_rtype_and_rid_and_created_at", using: :btree
-
- create_table "comfy_cms_sites", force: :cascade do |t|
- t.string "label", null: false
- t.string "identifier", null: false
- t.string "hostname", null: false
- t.string "path"
- t.string "locale", default: "en", null: false
+ create_table "comfy_cms_sites", id: :serial, force: :cascade do |t|
+ t.string "label", null: false
+ t.string "identifier", null: false
+ t.string "hostname", null: false
+ t.string "path"
+ t.string "locale", default: "en", null: false
t.boolean "is_mirrored", default: false, null: false
+ t.index ["hostname"], name: "index_comfy_cms_sites_on_hostname"
+ t.index ["is_mirrored"], name: "index_comfy_cms_sites_on_is_mirrored"
end
- add_index "comfy_cms_sites", ["hostname"], name: "index_comfy_cms_sites_on_hostname", using: :btree
- add_index "comfy_cms_sites", ["is_mirrored"], name: "index_comfy_cms_sites_on_is_mirrored", using: :btree
+ create_table "comfy_cms_snippets", id: :serial, force: :cascade do |t|
+ t.integer "site_id", null: false
+ t.string "label", null: false
+ t.string "identifier", null: false
+ t.text "content"
+ t.integer "position", default: 0, null: false
+ t.boolean "is_shared", default: false, null: false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.index ["site_id", "identifier"], name: "index_comfy_cms_snippets_on_site_id_and_identifier", unique: true
+ t.index ["site_id", "position"], name: "index_comfy_cms_snippets_on_site_id_and_position"
+ end
- create_table "comfy_cms_snippets", force: :cascade do |t|
- t.integer "site_id", null: false
- t.string "label", null: false
- t.string "identifier", null: false
- t.text "content"
- t.integer "position", default: 0, null: false
- t.boolean "is_shared", default: false, null: false
+ create_table "comments", id: :serial, force: :cascade do |t|
+ t.integer "post_id", null: false
+ t.integer "author_id", null: false
+ t.text "body", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
- add_index "comfy_cms_snippets", ["site_id", "identifier"], name: "index_comfy_cms_snippets_on_site_id_and_identifier", unique: true, using: :btree
- add_index "comfy_cms_snippets", ["site_id", "position"], name: "index_comfy_cms_snippets_on_site_id_and_position", using: :btree
-
- create_table "comments", force: :cascade do |t|
- t.integer "post_id", null: false
- t.integer "author_id", null: false
- t.text "body", null: false
+ create_table "crops", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.string "en_wikipedia_url"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "slug"
+ t.integer "parent_id"
+ t.integer "plantings_count", default: 0
+ t.integer "creator_id"
+ t.integer "requester_id"
+ t.string "approval_status", default: "approved"
+ t.text "reason_for_rejection"
+ t.text "request_notes"
+ t.text "rejection_notes"
+ t.boolean "perennial", default: false
+ t.integer "median_lifespan"
+ t.integer "median_days_to_first_harvest"
+ t.integer "median_days_to_last_harvest"
+ t.index ["name"], name: "index_crops_on_name"
+ t.index ["requester_id"], name: "index_crops_on_requester_id"
+ t.index ["slug"], name: "index_crops_on_slug", unique: true
end
- create_table "crops", force: :cascade do |t|
- t.string "name", null: false
- t.string "en_wikipedia_url"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.string "slug"
- t.integer "parent_id"
- t.integer "plantings_count", default: 0
- t.integer "creator_id"
- t.integer "requester_id"
- t.string "approval_status", default: "approved"
- t.text "reason_for_rejection"
- t.text "request_notes"
- t.text "rejection_notes"
- t.boolean "perennial", default: false
- t.integer "median_lifespan"
- t.integer "median_days_to_first_harvest"
- t.integer "median_days_to_last_harvest"
- end
-
- add_index "crops", ["name"], name: "index_crops_on_name", using: :btree
- add_index "crops", ["requester_id"], name: "index_crops_on_requester_id", using: :btree
- add_index "crops", ["slug"], name: "index_crops_on_slug", unique: true, using: :btree
-
create_table "crops_posts", id: false, force: :cascade do |t|
t.integer "crop_id"
t.integer "post_id"
+ t.index ["crop_id", "post_id"], name: "index_crops_posts_on_crop_id_and_post_id"
+ t.index ["crop_id"], name: "index_crops_posts_on_crop_id"
end
- add_index "crops_posts", ["crop_id", "post_id"], name: "index_crops_posts_on_crop_id_and_post_id", using: :btree
- add_index "crops_posts", ["crop_id"], name: "index_crops_posts_on_crop_id", using: :btree
-
- create_table "follows", force: :cascade do |t|
- t.integer "follower_id"
- t.integer "followed_id"
+ create_table "follows", id: :serial, force: :cascade do |t|
+ t.integer "follower_id"
+ t.integer "followed_id"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "forums", force: :cascade do |t|
- t.string "name", null: false
- t.text "description", null: false
- t.integer "owner_id", null: false
+ create_table "forums", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.text "description", null: false
+ t.integer "owner_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.string "slug"
+ t.string "slug"
+ t.index ["slug"], name: "index_forums_on_slug", unique: true
end
- add_index "forums", ["slug"], name: "index_forums_on_slug", unique: true, using: :btree
-
- create_table "gardens", force: :cascade do |t|
- t.string "name", null: false
- t.integer "owner_id"
- t.string "slug", null: false
+ create_table "gardens", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.integer "owner_id"
+ t.string "slug", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.text "description"
- t.boolean "active", default: true
- t.string "location"
- t.float "latitude"
- t.float "longitude"
- t.decimal "area"
- t.string "area_unit"
+ t.text "description"
+ t.boolean "active", default: true
+ t.string "location"
+ t.float "latitude"
+ t.float "longitude"
+ t.decimal "area"
+ t.string "area_unit"
+ t.index ["owner_id"], name: "index_gardens_on_owner_id"
+ t.index ["slug"], name: "index_gardens_on_slug", unique: true
end
- add_index "gardens", ["owner_id"], name: "index_gardens_on_owner_id", using: :btree
- add_index "gardens", ["slug"], name: "index_gardens_on_slug", unique: true, using: :btree
-
create_table "gardens_photos", id: false, force: :cascade do |t|
t.integer "photo_id"
t.integer "garden_id"
+ t.index ["garden_id", "photo_id"], name: "index_gardens_photos_on_garden_id_and_photo_id"
end
- add_index "gardens_photos", ["garden_id", "photo_id"], name: "index_gardens_photos_on_garden_id_and_photo_id", using: :btree
-
- create_table "harvests", force: :cascade do |t|
- t.integer "crop_id", null: false
- t.integer "owner_id", null: false
- t.date "harvested_at"
- t.decimal "quantity"
- t.string "unit"
- t.text "description"
+ create_table "harvests", id: :serial, force: :cascade do |t|
+ t.integer "crop_id", null: false
+ t.integer "owner_id", null: false
+ t.date "harvested_at"
+ t.decimal "quantity"
+ t.string "unit"
+ t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "slug"
- t.decimal "weight_quantity"
- t.string "weight_unit"
- t.integer "plant_part_id"
- t.float "si_weight"
- t.integer "planting_id"
+ t.string "slug"
+ t.decimal "weight_quantity"
+ t.string "weight_unit"
+ t.integer "plant_part_id"
+ t.float "si_weight"
+ t.integer "planting_id"
+ t.index ["planting_id"], name: "index_harvests_on_planting_id"
end
- add_index "harvests", ["planting_id"], name: "index_harvests_on_planting_id", using: :btree
-
create_table "harvests_photos", id: false, force: :cascade do |t|
t.integer "photo_id"
t.integer "harvest_id"
+ t.index ["harvest_id", "photo_id"], name: "index_harvests_photos_on_harvest_id_and_photo_id"
end
- add_index "harvests_photos", ["harvest_id", "photo_id"], name: "index_harvests_photos_on_harvest_id_and_photo_id", using: :btree
-
- create_table "likes", force: :cascade do |t|
- t.integer "member_id"
- t.integer "likeable_id"
- t.string "likeable_type"
- t.string "categories", array: true
+ create_table "likes", id: :serial, force: :cascade do |t|
+ t.integer "member_id"
+ t.integer "likeable_id"
+ t.string "likeable_type"
+ t.string "categories", array: true
t.datetime "created_at"
t.datetime "updated_at"
+ t.index ["likeable_id"], name: "index_likes_on_likeable_id"
+ t.index ["likeable_type", "likeable_id"], name: "index_likes_on_likeable_type_and_likeable_id"
+ t.index ["member_id"], name: "index_likes_on_member_id"
end
- add_index "likes", ["likeable_id"], name: "index_likes_on_likeable_id", using: :btree
- add_index "likes", ["likeable_type", "likeable_id"], name: "index_likes_on_likeable_type_and_likeable_id", using: :btree
- add_index "likes", ["member_id"], name: "index_likes_on_member_id", using: :btree
-
- create_table "median_functions", force: :cascade do |t|
+ create_table "median_functions", id: :serial, force: :cascade do |t|
end
- create_table "members", force: :cascade do |t|
- t.string "email", default: "", null: false
- t.string "encrypted_password", default: "", null: false
- t.string "reset_password_token"
+ create_table "members", id: :serial, force: :cascade do |t|
+ t.string "email", default: "", null: false
+ t.string "encrypted_password", default: "", null: false
+ t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
- t.integer "sign_in_count", default: 0
+ t.integer "sign_in_count", default: 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
- t.string "current_sign_in_ip"
- t.string "last_sign_in_ip"
- t.string "confirmation_token"
+ t.string "current_sign_in_ip"
+ t.string "last_sign_in_ip"
+ t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
- t.string "unconfirmed_email"
- t.integer "failed_attempts", default: 0
- t.string "unlock_token"
+ t.string "unconfirmed_email"
+ t.integer "failed_attempts", default: 0
+ t.string "unlock_token"
t.datetime "locked_at"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "login_name"
- t.string "slug"
- t.boolean "tos_agreement"
- t.boolean "show_email"
- t.string "location"
- t.float "latitude"
- t.float "longitude"
- t.boolean "send_notification_email", default: true
- t.text "bio"
- t.integer "plantings_count"
- t.boolean "newsletter"
- t.boolean "send_planting_reminder", default: true
- t.string "preferred_avatar_uri"
- t.integer "gardens_count"
- t.integer "harvests_count"
- t.integer "seeds_count"
+ t.string "login_name"
+ t.string "slug"
+ t.boolean "tos_agreement"
+ t.boolean "show_email"
+ t.string "location"
+ t.float "latitude"
+ t.float "longitude"
+ t.boolean "send_notification_email", default: true
+ t.text "bio"
+ t.integer "plantings_count"
+ t.boolean "newsletter"
+ t.boolean "send_planting_reminder", default: true
+ t.string "preferred_avatar_uri"
+ t.integer "gardens_count"
+ t.integer "harvests_count"
+ t.integer "seeds_count"
t.datetime "deleted_at"
+ t.index ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true
+ t.index ["deleted_at"], name: "index_members_on_deleted_at"
+ t.index ["email"], name: "index_members_on_email", unique: true
+ t.index ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true
+ t.index ["slug"], name: "index_members_on_slug", unique: true
+ t.index ["unlock_token"], name: "index_members_on_unlock_token", unique: true
end
- add_index "members", ["confirmation_token"], name: "index_members_on_confirmation_token", unique: true, using: :btree
- add_index "members", ["deleted_at"], name: "index_members_on_deleted_at", using: :btree
- add_index "members", ["email"], name: "index_members_on_email", unique: true, using: :btree
- add_index "members", ["reset_password_token"], name: "index_members_on_reset_password_token", unique: true, using: :btree
- add_index "members", ["slug"], name: "index_members_on_slug", unique: true, using: :btree
- add_index "members", ["unlock_token"], name: "index_members_on_unlock_token", unique: true, using: :btree
-
create_table "members_roles", id: false, force: :cascade do |t|
t.integer "member_id"
t.integer "role_id"
end
- create_table "notifications", force: :cascade do |t|
- t.integer "sender_id"
- t.integer "recipient_id", null: false
- t.string "subject"
- t.text "body"
- t.boolean "read", default: false
- t.integer "post_id"
+ create_table "notifications", id: :serial, force: :cascade do |t|
+ t.integer "sender_id"
+ t.integer "recipient_id", null: false
+ t.string "subject"
+ t.text "body"
+ t.boolean "read", default: false
+ t.integer "post_id"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "order_items", force: :cascade do |t|
- t.integer "order_id"
- t.integer "product_id"
- t.integer "price"
- t.integer "quantity"
+ create_table "order_items", id: :serial, force: :cascade do |t|
+ t.integer "order_id"
+ t.integer "product_id"
+ t.integer "price"
+ t.integer "quantity"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "orders", force: :cascade do |t|
+ create_table "orders", id: :serial, force: :cascade do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "completed_at"
- t.integer "member_id"
- t.string "paypal_express_token"
- t.string "paypal_express_payer_id"
- t.string "referral_code"
+ t.integer "member_id"
+ t.string "paypal_express_token"
+ t.string "paypal_express_payer_id"
+ t.string "referral_code"
end
create_table "orders_products", id: false, force: :cascade do |t|
@@ -383,28 +363,27 @@ ActiveRecord::Schema.define(version: 20171129041341) do
t.integer "product_id"
end
- create_table "photographings", force: :cascade do |t|
- t.integer "photo_id", null: false
- t.integer "photographable_id", null: false
- t.string "photographable_type", null: false
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ create_table "photographings", id: :serial, force: :cascade do |t|
+ t.integer "photo_id", null: false
+ t.integer "photographable_id", null: false
+ t.string "photographable_type", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["photographable_id", "photographable_type", "photo_id"], name: "items_to_photos_idx", unique: true
+ t.index ["photographable_id", "photographable_type"], name: "photographable_idx"
end
- add_index "photographings", ["photographable_id", "photographable_type", "photo_id"], name: "items_to_photos_idx", unique: true, using: :btree
- add_index "photographings", ["photographable_id", "photographable_type"], name: "photographable_idx", using: :btree
-
- create_table "photos", force: :cascade do |t|
- t.integer "owner_id", null: false
- t.string "thumbnail_url", null: false
- t.string "fullsize_url", null: false
+ create_table "photos", id: :serial, force: :cascade do |t|
+ t.integer "owner_id", null: false
+ t.string "thumbnail_url", null: false
+ t.string "fullsize_url", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.string "title", null: false
- t.string "license_name", null: false
- t.string "license_url"
- t.string "link_url", null: false
- t.string "flickr_photo_id"
+ t.string "title", null: false
+ t.string "license_name", null: false
+ t.string "license_url"
+ t.string "link_url", null: false
+ t.string "flickr_photo_id"
end
create_table "photos_plantings", id: false, force: :cascade do |t|
@@ -415,99 +394,97 @@ ActiveRecord::Schema.define(version: 20171129041341) do
create_table "photos_seeds", id: false, force: :cascade do |t|
t.integer "photo_id"
t.integer "seed_id"
+ t.index ["seed_id", "photo_id"], name: "index_photos_seeds_on_seed_id_and_photo_id"
end
- add_index "photos_seeds", ["seed_id", "photo_id"], name: "index_photos_seeds_on_seed_id_and_photo_id", using: :btree
-
- create_table "plant_parts", force: :cascade do |t|
- t.string "name"
+ create_table "plant_parts", id: :serial, force: :cascade do |t|
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "slug"
+ t.string "slug"
end
- create_table "plantings", force: :cascade do |t|
- t.integer "garden_id", null: false
- t.integer "crop_id", null: false
- t.date "planted_at"
- t.integer "quantity"
- t.text "description"
+ create_table "plantings", id: :serial, force: :cascade do |t|
+ t.integer "garden_id", null: false
+ t.integer "crop_id", null: false
+ t.date "planted_at"
+ t.integer "quantity"
+ t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "slug"
- t.string "sunniness"
- t.string "planted_from"
- t.integer "owner_id"
- t.boolean "finished", default: false
- t.date "finished_at"
- t.integer "lifespan"
- t.integer "days_to_first_harvest"
- t.integer "days_to_last_harvest"
+ t.string "slug"
+ t.string "sunniness"
+ t.string "planted_from"
+ t.integer "owner_id"
+ t.boolean "finished", default: false
+ t.date "finished_at"
+ t.integer "lifespan"
+ t.integer "days_to_first_harvest"
+ t.integer "days_to_last_harvest"
+ t.boolean "failed"
+ t.text "failure_cause"
+ t.index ["failed"], name: "index_plantings_on_failed"
+ t.index ["slug"], name: "index_plantings_on_slug", unique: true
end
- add_index "plantings", ["slug"], name: "index_plantings_on_slug", unique: true, using: :btree
-
- create_table "posts", force: :cascade do |t|
- t.integer "author_id", null: false
- t.string "subject", null: false
- t.text "body", null: false
+ create_table "posts", id: :serial, force: :cascade do |t|
+ t.integer "author_id", null: false
+ t.string "subject", null: false
+ t.text "body", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.string "slug"
- t.integer "forum_id"
+ t.string "slug"
+ t.integer "forum_id"
+ t.index ["created_at", "author_id"], name: "index_posts_on_created_at_and_author_id"
+ t.index ["slug"], name: "index_posts_on_slug", unique: true
end
- add_index "posts", ["created_at", "author_id"], name: "index_posts_on_created_at_and_author_id", using: :btree
- add_index "posts", ["slug"], name: "index_posts_on_slug", unique: true, using: :btree
-
- create_table "products", force: :cascade do |t|
- t.string "name", null: false
- t.text "description", null: false
- t.integer "min_price", null: false
+ create_table "products", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.text "description", null: false
+ t.integer "min_price", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "account_type_id"
- t.integer "paid_months"
- t.integer "recommended_price"
+ t.integer "account_type_id"
+ t.integer "paid_months"
+ t.integer "recommended_price"
end
- create_table "roles", force: :cascade do |t|
- t.string "name", null: false
- t.text "description"
+ create_table "roles", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "slug"
+ t.string "slug"
+ t.index ["slug"], name: "index_roles_on_slug", unique: true
end
- add_index "roles", ["slug"], name: "index_roles_on_slug", unique: true, using: :btree
-
- create_table "scientific_names", force: :cascade do |t|
- t.string "name", null: false
- t.integer "crop_id", null: false
+ create_table "scientific_names", id: :serial, force: :cascade do |t|
+ t.string "name", null: false
+ t.integer "crop_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "creator_id"
+ t.integer "creator_id"
end
- create_table "seeds", force: :cascade do |t|
- t.integer "owner_id", null: false
- t.integer "crop_id", null: false
- t.text "description"
- t.integer "quantity"
- t.date "plant_before"
+ create_table "seeds", id: :serial, force: :cascade do |t|
+ t.integer "owner_id", null: false
+ t.integer "crop_id", null: false
+ t.text "description"
+ t.integer "quantity"
+ t.date "plant_before"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "tradable_to", default: "nowhere"
- t.string "slug"
- t.integer "days_until_maturity_min"
- t.integer "days_until_maturity_max"
- t.text "organic", default: "unknown"
- t.text "gmo", default: "unknown"
- t.text "heirloom", default: "unknown"
+ t.string "tradable_to", default: "nowhere"
+ t.string "slug"
+ t.integer "days_until_maturity_min"
+ t.integer "days_until_maturity_max"
+ t.text "organic", default: "unknown"
+ t.text "gmo", default: "unknown"
+ t.text "heirloom", default: "unknown"
+ t.index ["slug"], name: "index_seeds_on_slug", unique: true
end
- add_index "seeds", ["slug"], name: "index_seeds_on_slug", unique: true, using: :btree
-
add_foreign_key "harvests", "plantings"
add_foreign_key "photographings", "photos"
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 7df7e0e4c..a1477fbe6 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -134,7 +134,7 @@ end
def create_cropbot
@cropbot_user = Member.new(
login_name: "cropbot",
- email: Growstuff::Application.config.bot_email,
+ email: Rails.application.config.bot_email,
password: SecureRandom.urlsafe_base64(64),
tos_agreement: true
)
diff --git a/lib/haml/filters/growstuff_markdown.rb b/lib/haml/filters/growstuff_markdown.rb
index b7b257b53..51d95d1fe 100644
--- a/lib/haml/filters/growstuff_markdown.rb
+++ b/lib/haml/filters/growstuff_markdown.rb
@@ -17,7 +17,7 @@ module Haml::Filters # rubocop:disable Style/ClassAndModuleChildren
MEMBER_REGEX = /(?#{name}" if name
"#{crop.name}"
end
diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb
index 1911ae8da..c538ad38d 100644
--- a/spec/models/member_spec.rb
+++ b/spec/models/member_spec.rb
@@ -29,7 +29,7 @@ describe 'member' do
end
it "should have a default-type account by default" do
- member.account.account_type.name.should eq Growstuff::Application.config.default_account_type
+ member.account.account_type.name.should eq Rails.application.config.default_account_type
member.paid?.should be(false)
end
diff --git a/spec/views/layouts/application_spec.rb b/spec/views/layouts/application_spec.rb
index f094ae2c2..e706bc575 100644
--- a/spec/views/layouts/application_spec.rb
+++ b/spec/views/layouts/application_spec.rb
@@ -6,7 +6,7 @@ describe 'layouts/application.html.haml', type: "view" do
end
it 'includes the analytics code' do
- Growstuff::Application.config.analytics_code = ''
+ Rails.application.config.analytics_code = ''
render
assert_select "script", text: 'alert("foo!")'
rendered.should_not have_content 'script'
diff --git a/spec/views/orders/show.html.haml_spec.rb b/spec/views/orders/show.html.haml_spec.rb
index a9f662de9..4f9c7d7f6 100644
--- a/spec/views/orders/show.html.haml_spec.rb
+++ b/spec/views/orders/show.html.haml_spec.rb
@@ -31,7 +31,7 @@ describe "orders/show" do
end
it "shows a foreign exchange link for the total" do
- currency = Growstuff::Application.config.currency
+ currency = Rails.application.config.currency
assert_select("a[href='http://www.wolframalpha.com/input/?i=198.00+#{currency}']")
end
diff --git a/spec/views/shop/index_spec.rb b/spec/views/shop/index_spec.rb
index 754f05c09..29b740c92 100644
--- a/spec/views/shop/index_spec.rb
+++ b/spec/views/shop/index_spec.rb
@@ -20,20 +20,20 @@ describe 'shop/index.html.haml', type: "view" do
end
it 'shows prices in configured currency' do
- rendered.should have_content format('9.99 %s', Growstuff::Application.config.currency)
+ rendered.should have_content format('9.99 %s', Rails.application.config.currency)
end
it 'should contain an exchange rate link' do
- currency = Growstuff::Application.config.currency
+ currency = Rails.application.config.currency
assert_select("a[href='http://www.wolframalpha.com/input/?i=9.99+#{currency}']")
end
it 'shows recommended price for products that have it' do
- rendered.should have_content format('12.00 %s', Growstuff::Application.config.currency)
+ rendered.should have_content format('12.00 %s', Rails.application.config.currency)
end
it 'should contain an exchange rate link for recommended price' do
- currency = Growstuff::Application.config.currency
+ currency = Rails.application.config.currency
assert_select("a[href='http://www.wolframalpha.com/input/?i=12.00+#{currency}']")
end