mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-04-04 23:24:49 -04:00
@@ -4,8 +4,9 @@ module Growstuff
|
||||
PLANTING = { type: 'planting', class: 'Planting', relation: 'plantings' }.freeze
|
||||
HARVEST = { type: 'harvest', class: 'Harvest', relation: 'harvests' }.freeze
|
||||
GARDEN = { type: 'garden', class: 'Garden', relation: 'gardens' }.freeze
|
||||
SEED = { type: 'seed', class: 'Seed', relation: 'seeds' }.freeze
|
||||
|
||||
ALL = [PLANTING, HARVEST, GARDEN].freeze
|
||||
ALL = [PLANTING, HARVEST, GARDEN, SEED].freeze
|
||||
|
||||
def self.types
|
||||
ALL.map do |model|
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class Seed < ActiveRecord::Base
|
||||
extend FriendlyId
|
||||
include PhotoCapable
|
||||
friendly_id :seed_slug, use: [:slugged, :finders]
|
||||
|
||||
belongs_to :crop
|
||||
|
||||
9
db/migrate/20161201154922_add_photos_seeds_table.rb
Normal file
9
db/migrate/20161201154922_add_photos_seeds_table.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class AddPhotosSeedsTable < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :photos_seeds, id: false do |t|
|
||||
t.integer :photo_id
|
||||
t.integer :seed_id
|
||||
end
|
||||
add_index(:photos_seeds, [:seed_id, :photo_id])
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20161129021533) do
|
||||
ActiveRecord::Schema.define(version: 20161201154922) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -373,6 +373,13 @@ ActiveRecord::Schema.define(version: 20161129021533) do
|
||||
t.integer "planting_id"
|
||||
end
|
||||
|
||||
create_table "photos_seeds", id: false, force: :cascade do |t|
|
||||
t.integer "photo_id"
|
||||
t.integer "seed_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"
|
||||
t.datetime "created_at"
|
||||
|
||||
Reference in New Issue
Block a user