インスタンス変数を定義したつもりですが、以下のようなエラーが出て困っています。
NameError in GoodthingController#index uninitialized constant GoodthingController::GoodthingForm Extracted source (around line #7): 6 def index 7 @goodthing_form = GoodthingForm.new(goodthing_form_params) 8 if @goodthing_form.valid? 9 ar = current_organization.users.without_soft_destroyed.joins(groups,:profile,:comments).includes(:profile,:comments) 10 ar = ar.where("`profile.open_goodthing LIKE ?", true) Rails.root: /home/ec2-user/environment/web-app Application Trace | Framework Trace | Full Trace app/controllers/goodthing_controller.rb:7:in `index'
model部分は下記のようになっています。
app/forms/goodthing_form.rb
ruby
1class GoodthingForm < FormBase 2 3 attr_accessor :from, :to, :name, :group 4 5 validates :from, date: true, format: {with: /\d{4}-\d{2}-\d{2}/, allow_blank: true} 6 validates :to, date: true, format: {with: /\d{4}-\d{2}-\d{2}/, allow_blank: true} 7 validate :check_reversive 8 validates :name, length: {maximum: 30} 9 validates :group, length: {maximum: 30} 10end 11 12 def check_reversive 13 if from.present? && to.present? && Date.parse(from) > Date.parse(to) 14 errors.add(:to, :period_error) 15 end 16 end
uninitialized constantは「定義したクラスが読み込まれていない」ということはわかりましたが
具体的にどの部分を修正すればいいかがわからなくて困っています。
ご教授していただけたら幸いです。
宜しくお願いいたします。