I tried persistently to search for this error, but to no avail. I currently have these models.
application / models / survey.rb
class Survey < ActiveRecord::Base
belongs_to :user
has_attached_file :original, :default_url => "/public/:class/:attachment/:basename.:extension"
has_many :sub_surveys, :dependent => :destroy
end
application / models / sub_survey.rb
class SubSurvey < ActiveRecord::Base
belongs_to :survey
has_many :questions, :dependent => :destroy
end
application / models / question.rb
class Question < ActiveRecord::Base
belongs_to :sub_survey
validates_presence_of :sub_survey
acts_as_list :scope => :sub_survey
has_many :answers, :dependent => :destroy
has_many :choices, :dependent => :destroy
end
application / models / choice.rb
class Choices < ActiveRecord::Base
belongs_to :question
validates_presence_of :question
end
app / models / answer.rb
class Answer < ActiveRecord::Base
belongs_to :question
belongs_to :user
belongs_to :game
validates_uniqueness_of :question_id, :scope => [:user_id, :game_id]
end
Now when I try to destroy the survey, I get an error
uninitialized constant Question::Choice
This tracks through / vendor / rails / active * after polling. destroy
Then, when I try to access the selections from question.Choices, I get an error
undefined method `Choices' for #<Question:0xb7224f2c>
which for some reason has this on top of the trace stack
vendor/rails/activerecord/lib/active_record/attribute_methods.rb:256:in `method_missing'
vendor/plugins/attribute_fu/lib/attribute_fu/associations.rb:28:in `method_missing'
app/views/answers/_answer.html.erb:7:in `_run_erb_47app47views47answers47_answer46html46erb'
I use the fu attribute when importing polls in xml format, but I have no idea why the question is traced. He is supported.
, .
?