mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-05 15:11:01 -05:00
fix up erros on planting form
This commit is contained in:
@@ -46,7 +46,9 @@ class PlantingsController < ApplicationController
|
||||
|
||||
# using find_by_id here because it returns nil, unlike find
|
||||
@crop = Crop.approved.find_by(id: params[:crop_id]) || Crop.new
|
||||
@garden = Garden.find_by(owner: current_member, id: params[:garden_id])
|
||||
@planting.garden = Garden.find_by(
|
||||
owner: current_member,
|
||||
id: params[:garden_id]) if params[:garden_id]
|
||||
|
||||
respond_with @planting
|
||||
end
|
||||
|
||||
@@ -27,15 +27,11 @@
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
- if @garden.present?
|
||||
%p Planted in #{link_to @garden, @garden}
|
||||
= f.hidden_field :garden_id, value: @garden.id
|
||||
- else
|
||||
= f.collection_radio_buttons(:garden_id,
|
||||
@planting.owner.gardens.active.order_by_name,
|
||||
:id, :name, required: true,
|
||||
label: 'Where did you plant it?')
|
||||
= link_to "Add a garden.", new_garden_path
|
||||
= f.collection_radio_buttons(:garden_id,
|
||||
@planting.owner.gardens.active.order_by_name,
|
||||
:id, :name, required: true,
|
||||
label: 'Where did you plant it?')
|
||||
= link_to "Add a garden.", new_garden_path
|
||||
.col-md-4
|
||||
= f.text_field :planted_at,
|
||||
value: @planting.planted_at ? @planting.planted_at.to_s(:ymd) : '',
|
||||
|
||||
Reference in New Issue
Block a user