This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AfterTraining <ActiveRecord::Base | |
belongs_to :gardener | |
has_one :experience | |
has_one :network | |
has_one :veg_expenditure | |
has_one :health | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gardener.joins(:support_visits).group(:gardener_id).select("SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z | |
D, [2015-10-11T19:21:42.481818 #3] DEBUG -- : Gardener Load (1.2ms) SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits" ON "support_visits"."gardener_id" = "gardeners"."id" GROUP BY gardener_id | |
PG::GroupingError: ERROR: aggregate function calls cannot be nested | |
LINE 1: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z... | |
^ | |
: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits" ON "support_visits"."gardener_id" = "gardeners"."id" GROUP BY gardener_id | |
PG::GroupingError: ERROR: aggregate function calls cannot be nested | |
LINE 1: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS z... | |
^ | |
: SELECT SUM(CASE WHEN count(gardener_id) = 1 THEN 1 END) AS zero_count FROM "gardeners" INNER JOIN "support_visits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gardener < ActiveRecord::Base | |
has_many :support_visits | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= form_for([@group, @gardener, @garden]) do |g| %> | |
<div class="panel panel-default"> | |
<%= render "shared/error_messages", :target => @garden %> | |
<h3> Garden information </h3> | |
<%= g.fields_for :physical_info do |pi| %> | |
<div class="field" > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GroupEvaluationsController <ApplicationController | |
def new | |
session[:group_evaluation_params] ||= {} | |
@group = Group.all | |
@group_evaluation = GroupEvaluation.new | |
end | |
def edit | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
undefined method `avatar_file_size=' for nil:NilClass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gardener < ActiveRecord::Base | |
belongs_to :group | |
has_many :answers | |
#has_and_belongs_to_many :questionnaires, join_table: 'gardener_questionnaires' | |
#has_and_belongs_to_many :questionnaires, join_table: 'gardener_questionnaires' | |
#has_many :answers, through: :gardener_questionnaires | |
has_many :attendance_registers_training_sessions | |
has_many :attendance_registers, through: :attendance_registers_training_sessions | |
has_many :support_visits, dependent: :destroy | |
has_one :garden, dependent: :destroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FollowUpVisit <ActiveRecord::Base | |
belongs_to :gardener | |
has_one :follow_up_visit_eating | |
has_one :follow_up_visit_garden | |
has_one :follow_up_visit_impression | |
has_one :follow_up_visit_selling | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="panel panel-default"> | |
<%= form_for([@follow_up_visit, @follow_up_visit_garden]) do |g| %> | |
<fieldset> | |
<%= g.label :date_created, "The date the form was filled in" %> | |
<%= g.date_select (:date_created) %> <br/> | |
<%= g.label :still_gardening, "Is the gardener still gardening?" %> <br/> | |
<%= g.check_box :still_gardening %> <body> rememeber to tick if true </body> | |
</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FollowUpVisitGardensController < ApplicationController | |
def new | |
#1st you retrieve the group thanks to params[:group_id] | |
#2nd you build a new comment | |
@follow_up_visit = FollowUpVisit.find(params[:follow_up_visit_id]) | |
@follow_up_visit_garden= FollowUpVisitGarden.new | |
@gardener = @follow_up_visit.gardener | |
if @gardener.valid? | |
render "new" |
NewerOlder