[STABLE] Add img_url, icon_url, openfarm_slug to backend models

pull/251/head
Rick Carlino 2016-06-24 14:51:56 -05:00
parent d5b0717e54
commit 645aac0507
2 changed files with 16 additions and 3 deletions

View File

@ -6,7 +6,12 @@ class Plant
belongs_to :device
belongs_to :planting_area
field :name, default: "Unknown Plant"
field :x, type: Integer
field :y, type: Integer
field :name, default: "Unknown Plant"
field :img_url, default: "http://placehold.it/200x150"
field :icon_url, default: "/icons/Natural Food-96.png"
field :openfarm_slug, default: "not-set"
field :x, type: Integer
field :y, type: Integer
field :planted_at, type: Time, default: ->{ Time.now.utc }
end

View File

@ -6,6 +6,14 @@ module Plants
float :y
end
optional do
string :name, default: "Unknown Plant"
string :img_url, default: "http://placehold.it/200x150"
string :icon_url, default: "/icons/Natural Food-96.png"
string :openfarm_slug, default: "not-set"
integer :planted_at, default: ->{ Time.now.utc }
end
def execute
Plant.create!(inputs)
end