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

  • SEARCH
  • Home
  • 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 8698903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:49:33+00:00 2026-06-13T01:49:33+00:00

Here is my current model structure class Customer < ActiveRecord::Base self.inheritance_column = ‘customer_type’ has_one

  • 0

Here is my current model structure

class Customer < ActiveRecord::Base
  self.inheritance_column = 'customer_type'

  has_one :contact
  accepts_nested_attributes_for :contact
end

class Vendor < Customer

  has_many :domains
  accepts_nested_attributes_for :domains
end

class Club < Customer
end

When i create a form for vendor

= form_for @vendor do |f|
  = f.fields_for :contact do |c|
    ....
  = f.fields_for :domains do |d|
    ...

it renders properly. Same thing with club without the domains. Now when i edit it and click update for vendor for it gives me the following error

NoMethodError: undefined method `[]' for nil:NilClass
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/nested_attributes.rb:327:in `assign_nested_attributes_for_one_to_one_association'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/nested_attributes.rb:288:in `contact_attributes='
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/attribute_assignment.rb:94:in `block in assign_attributes'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/attribute_assignment.rb:93:in `each'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/attribute_assignment.rb:93:in `assign_attributes'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/persistence.rb:212:in `block in update_attributes'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:190:in `transaction'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/transactions.rb:208:in `transaction'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/persistence.rb:211:in `update_attributes'
app/controllers/vendors_controller.rb:34:in `update'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/abstract_controller/base.rb:167:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/rendering.rb:10:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:514:in `block in _run__551367052__process_action__739945711__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:215:in `block in _conditional_callback_around_1211'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:326:in `around'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:310:in `_callback_around_13'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:214:in `_conditional_callback_around_1211'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:403:in `_run__551367052__process_action__739945711__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:405:in `__run_callback'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:81:in `run_callbacks'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/abstract_controller/callbacks.rb:17:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/rescue.rb:29:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/notifications.rb:123:in `block in instrument'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/notifications.rb:123:in `instrument'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/abstract_controller/base.rb:121:in `process'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/abstract_controller/rendering.rb:45:in `process'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal.rb:203:in `dispatch'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_controller/metal.rb:246:in `block in action'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/routing/route_set.rb:66:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/routing/route_set.rb:30:in `call'
[GEM_ROOT]/gems/journey-1.0.0/lib/journey/router.rb:60:in `block in call'
[GEM_ROOT]/gems/journey-1.0.0/lib/journey/router.rb:48:in `each'
[GEM_ROOT]/gems/journey-1.0.0/lib/journey/router.rb:48:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/routing/route_set.rb:570:in `call'
[GEM_ROOT]/gems/sass-3.1.12/lib/sass/plugin/rack.rb:54:in `call'
[GEM_ROOT]/gems/warden-1.1.1/lib/warden/manager.rb:35:in `block in call'
[GEM_ROOT]/gems/warden-1.1.1/lib/warden/manager.rb:34:in `catch'
[GEM_ROOT]/gems/warden-1.1.1/lib/warden/manager.rb:34:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/conditionalget.rb:35:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/head.rb:14:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/flash.rb:242:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/cookies.rb:338:in `call'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/query_cache.rb:64:in `call'
[GEM_ROOT]/gems/activerecord-3.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:405:in `_run__575954635__call__637953697__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:405:in `__run_callback'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/callbacks.rb:81:in `run_callbacks'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/sendfile.rb:102:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
[GEM_ROOT]/gems/railties-3.2.0/lib/rails/rack/logger.rb:26:in `call_app'
[GEM_ROOT]/gems/railties-3.2.0/lib/rails/rack/logger.rb:14:in `block in call'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/tagged_logging.rb:25:in `tagged'
[GEM_ROOT]/gems/railties-3.2.0/lib/rails/rack/logger.rb:14:in `call'
[GEM_ROOT]/gems/actionpack-3.2.0/lib/action_dispatch/middleware/request_id.rb:22:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
[GEM_ROOT]/gems/activesupport-3.2.0/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
[GEM_ROOT]/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
[GEM_ROOT]/gems/rack-cache-1.1/lib/rack/cache/context.rb:132:in `forward'
[GEM_ROOT]/gems/rack-cache-1.1/lib/rack/cache/context.rb:139:in `pass'
[GEM_ROOT]/gems/rack-cache-1.1/lib/rack/cache/context.rb:151:in `invalidate'
[GEM_ROOT]/gems/rack-cache-1.1/lib/rack/cache/context.rb:70:in `call!'
[GEM_ROOT]/gems/rack-cache-1.1/lib/rack/cache/context.rb:50:in `call'
[GEM_ROOT]/gems/railties-3.2.0/lib/rails/engine.rb:479:in `call'
[GEM_ROOT]/gems/railties-3.2.0/lib/rails/application.rb:220:in `call'
[GEM_ROOT]/gems/railties-3.2.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/utils.rb:479:in `safe_fork'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:180:in `start'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
:
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
[GEM_ROOT]/gems/passenger-3.0.11/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
[GEM_ROOT]/gems/passenger-3.0.11/helper-scripts/passenger-spawn-server:99:in `&lt;main&gt;'

If I take domains association and move that into customer, it works fine.. but it does seem to like having that association in the child model.

Am I doing something wrong or is this a peculiar bug?

Update: We recently installed thinking sphinx into the application. It could be related to that as well.

  • 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-06-13T01:49:34+00:00Added an answer on June 13, 2026 at 1:49 am

    We found the fix. the problem was that we added the define_index block after the association definition but before the accepts_nested_attributes_for definition. we moved it below everything and everything works fine now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the current code I am using: <UserControl xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Class=ButtonPrototype.MainPage Width=640 Height=480>
Here is model of my table structure. Three tables. ---------------- ---------------------------- ------------------------------- |possibilities |
Here's my current situation: I have a NSMutableArray named dictKeyArray which I assign a
Here is the current code in my application: String[] ids = str.split("/"); When profiling
Here is the current code I am using to parse the URL and it's
Here is my current position with a Jquery Banner - http://jsfiddle.net/WcXBs/2/ Apologies for the
Here is my current setup. I have two pages running on the jquery mobile
Here is my current code in the controller. @rating = (@approvals.count / @user.pages.count) +
Here is my current situation; I am a near complete regexp illiterate, and have
Here is my current setup: Database Role - MyDbRole Schema - MySchema User -

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.