Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4103386
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:57:06+00:00 2026-05-20T20:57:06+00:00

I have models class Survey < ActiveRecord::Base has_many :questions acts_as_list validates :title, :presence =>true

  • 0

I have models

class Survey < ActiveRecord::Base
  has_many :questions
  acts_as_list

  validates :title, :presence =>true
  validates :short_description, :presence=>true
  validates :description, :presence=>true

end


class Question < ActiveRecord::Base
  belongs_to :survey
  has_many :options

  accepts_nested_attributes_for :options, :reject_if => lambda { |a| a[:title].blank? }, :allow_destroy => true

  acts_as_list :scope=>:survey
end

class Option < ActiveRecord::Base
  attr_accessible :title, :description, :position
  belongs_to :question

  acts_as_list :scope=>:survey
end

when i save or update question model it generate an error

@question        = Question.new(params[:question])
@question.save
@question        = Question.find(params[:id])
@question.update_attributes(params[:question])

In both cases it generates an error

NoMethodError (undefined method `survey_id' for #<Option:0xb332394>):
  app/controllers/admin/questions_controller.rb:47:in `block in create'
  app/controllers/admin/questions_controller.rb:46:in `create'

I can not understand why it is generating this error, since Option do not have any relation to Survey

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:57:07+00:00Added an answer on May 20, 2026 at 8:57 pm

    Could it be this (on Option):

    class Option < ActiveRecord::Base
      attr_accessible :title, :description, :position
      belongs_to :question
    
      acts_as_list :scope=>:survey   # <-- no survey_id ??
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three models: class ReleaseItem < ActiveRecord::Base has_many :pack_release_items has_one :pack, :through =>
I have the following models. # app/models/domain/domain_object.rb class Domain::DomainObject < ActiveRecord::Base has_many :links_from, :class_name
I have models: class User < ActiveRecord::Base has_many :user_skills end class UserSkill < ActiveRecord::Base
I have three models class Collection < ActiveRecord::Base has_many :presentations has_many :galleries, :through =>
I have the following models: class Campaign < ActiveRecord::Base has_many :campaign_keywords has_many :leads, :through
I have the following models: class Instance < ActiveRecord::Base has_many :users has_many :books end
I have three models: class Tenant < ActiveRecord::Base has_many :sites end class Site <
I have two models class User < ActiveRecord::Base has_many :requests, :foreign_key => :recipient_id .
I have two models: class Member < ActiveRecord::Base has_many :member_tags end and class MemberTag
I have three models: class User < ActiveRecord::Base has_many :projects, :through => :permissions class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.