mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 21:56:55 -04:00
Updated code for Rail 5
This commit is contained in:
2
Rakefile
2
Rakefile
@@ -5,4 +5,4 @@
|
||||
require 'rake/dsl_definition'
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
Growstuff::Application.load_tasks
|
||||
Rails.application.load_tasks
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
38
bin/setup
Executable file
38
bin/setup
Executable file
@@ -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
|
||||
29
bin/update
Executable file
29
bin/update
Executable file
@@ -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
|
||||
11
bin/yarn
Executable file
11
bin/yarn
Executable file
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: redis://localhost:6379/1
|
||||
channel_prefix: growstuff_production
|
||||
@@ -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!
|
||||
|
||||
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
@@ -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
|
||||
14
config/initializers/assets.rb
Normal file
14
config/initializers/assets.rb
Normal file
@@ -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 )
|
||||
5
config/initializers/cookies_serializer.rb
Normal file
5
config/initializers/cookies_serializer.rb
Normal file
@@ -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
|
||||
4
config/initializers/filter_parameter_logging.rb
Normal file
4
config/initializers/filter_parameter_logging.rb
Normal file
@@ -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]
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
56
config/puma.rb
Normal file
56
config/puma.rb
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
%w(
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
).each { |path| Spring.watch(path) }
|
||||
629
db/schema.rb
629
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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ module Haml::Filters # rubocop:disable Style/ClassAndModuleChildren
|
||||
MEMBER_REGEX = /(?<!\\)\[([^\[\]]+?)\]\(member\)/
|
||||
MEMBER_AT_REGEX = /(?<!\\)(\@\w+)/
|
||||
MEMBER_ESCAPE_AT_REGEX = /(?<!\\)\\(?=\@\w+)/
|
||||
HOST = Growstuff::Application.config.host
|
||||
HOST = Rails.application.config.host
|
||||
|
||||
def expand_crops!
|
||||
# turn [tomato](crop) into [tomato](http://growstuff.org/crops/tomato)
|
||||
|
||||
@@ -3,7 +3,7 @@ require 'rails_helper'
|
||||
describe ApplicationHelper do
|
||||
it "formats prices" do
|
||||
price_in_dollars(999).should eq '9.99'
|
||||
price_with_currency(999).should eq format('9.99 %s', Growstuff::Application.config.currency)
|
||||
price_with_currency(999).should eq format('9.99 %s', Rails.application.config.currency)
|
||||
end
|
||||
|
||||
it "parses dates" do
|
||||
|
||||
@@ -7,7 +7,7 @@ def input_link(name)
|
||||
end
|
||||
|
||||
def output_link(crop, name = nil)
|
||||
url = Rails.application.routes.url_helpers.crop_url(crop, host: Growstuff::Application.config.host)
|
||||
url = Rails.application.routes.url_helpers.crop_url(crop, host: Rails.application.config.host)
|
||||
return "<a href=\"#{url}\">#{name}</a>" if name
|
||||
"<a href=\"#{url}\">#{crop.name}</a>"
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ describe 'layouts/application.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'includes the analytics code' do
|
||||
Growstuff::Application.config.analytics_code = '<script>alert("foo!")</script>'
|
||||
Rails.application.config.analytics_code = '<script>alert("foo!")</script>'
|
||||
render
|
||||
assert_select "script", text: 'alert("foo!")'
|
||||
rendered.should_not have_content 'script'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user