Hi!

So, here's the structure that I have:


Service
------------
Id


ServiceRestrictions
-----------------------------
Id
ServiceId
RestrictedServiceId


In the ServiceRestrictions table, both the ServiceId and the
RestrictedServiceId refer to the Service table's Id field.  Basically
a given Service can be restricted by any number of other services.


Here's what I have in my models:

MyService:
--------------
has_many :service_restrictions, :foreign_key => :ServiceId

ServiceRestrictions:
--------------------------------
belongs_to :service, :class_name => 'MyService', :foreign_key
=> :ServiceId
belongs_to :restricted_service, :class_name =>
'MyService', :foreign_key => :RestrictedServiceId



On the Services page, I have an AS grid.  On a given record, I click
on the Update Record, it brings up the edit UI for the given record.
On the UI, there is a section for editing Service Restrictions.  It
uses record_select.

Whether or not I edit any of the Restrictions or add or delete any,
when I go to try to save the record, I get the following error (and
any help figuring this out will be much appreciated!):



NoMethodError (undefined method `respond_to' for #<ServiceRestriction:
0x7f74de573fc8>):
  vendor/rails/activerecord/lib/active_record/attribute_methods.rb:
264:in `method_missing'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
8:in `associated_valid?'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
63:in `with_unsaved_associated'
  vendor/rails/activerecord/lib/active_record/attribute_methods.rb:
211:in `all?'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
57:in `each'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
57:in `all?'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
57:in `with_unsaved_associated'
  vendor/rails/activerecord/lib/active_record/attribute_methods.rb:
211:in `all?'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
51:in `each'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
51:in `all?'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
51:in `with_unsaved_associated'
  vendor/plugins/active_scaffold/lib/extensions/unsaved_associated.rb:
8:in `associated_valid?'
  vendor/plugins/active_scaffold/lib/active_scaffold/actions/update.rb:
77:in `do_update'
  vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/database_statements.rb:136:in `transaction'
  vendor/rails/activerecord/lib/active_record/transactions.rb:182:in
`transaction'
  vendor/plugins/active_scaffold/lib/active_scaffold/actions/update.rb:
74:in `do_update'
  vendor/plugins/active_scaffold/lib/active_scaffold/actions/update.rb:
16:in `update'
  vendor/rails/actionpack/lib/action_controller/base.rb:1331:in `send'
  vendor/rails/actionpack/lib/action_controller/base.rb:1331:in
`perform_action_without_filters'
  vendor/rails/actionpack/lib/action_controller/filters.rb:617:in
`call_filters'
  vendor/rails/actionpack/lib/action_controller/filters.rb:610:in
`perform_action_without_benchmark'
  vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
  vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:
17:in `ms'
  /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
  vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:
17:in `ms'
  vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
  vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in
`perform_action_without_flash'
  vendor/rails/actionpack/lib/action_controller/flash.rb:151:in
`perform_action_without_render_component'
  vendor/plugins/render_component/lib/components.rb:39:in
`perform_action'
  vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
  vendor/rails/actionpack/lib/action_controller/base.rb:532:in
`process_without_filters'
  vendor/rails/actionpack/lib/action_controller/filters.rb:606:in
`process'
  vendor/rails/actionpack/lib/action_controller/base.rb:391:in
`process'
  vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
  vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:
438:in `call'
  vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in
`dispatch'
  vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in
`_call'
  vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130
  vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in
`call'
  vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in
`call'
  vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/query_cache.rb:34:in `cache'
  vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in
`cache'
  vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in
`call'
  vendor/rails/activerecord/lib/active_record/connection_adapters/
abstract/connection_pool.rb:361:in `call'
  vendor/rails/actionpack/lib/action_controller/string_coercion.rb:
25:in `call'
  rack (1.1.0) lib/rack/head.rb:9:in `call'
  rack (1.1.0) lib/rack/methodoverride.rb:24:in `call'
  vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in
`call'
  vendor/rails/actionpack/lib/action_controller/session/
cookie_store.rb:99:in `call'
  vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in
`call'
  rack (1.1.0) lib/rack/lock.rb:11:in `call'
  rack (1.1.0) lib/rack/lock.rb:11:in `synchronize'
  rack (1.1.0) lib/rack/lock.rb:11:in `call'
  vendor/rails/actionpack/lib/action_controller/dispatcher.rb:114:in
`call'
  vendor/rails/actionpack/lib/action_controller/reloader.rb:34:in
`run'
  vendor/rails/actionpack/lib/action_controller/dispatcher.rb:108:in
`call'
  vendor/rails/railties/lib/rails/rack/static.rb:31:in `call'
  rack (1.1.0) lib/rack/urlmap.rb:47:in `call'
  rack (1.1.0) lib/rack/urlmap.rb:41:in `each'
  rack (1.1.0) lib/rack/urlmap.rb:41:in `call'
  vendor/rails/railties/lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.1.0) lib/rack/content_length.rb:13:in `call'
  rack (1.1.0) lib/rack/handler/webrick.rb:48:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
  /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
  /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
  /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
  /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
  /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
  rack (1.1.0) lib/rack/handler/webrick.rb:14:in `run'
  vendor/rails/railties/lib/commands/server.rb:111
  /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
  /script/server:3
  /usr/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.10/lib/ruby-debug-
ide.rb:109:in `debug_load'
  /usr/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.10/lib/ruby-debug-
ide.rb:109:in `debug_program'
  /usr/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.4.10/bin/rdebug-ide:87
  /usr/bin/rdebug-ide:19:in `load'
  /usr/bin/rdebug-ide:19

Rendered rescues/_trace (139.6ms)
Rendered rescues/_request_and_response (4.9ms)
Rendering rescues/layout (internal_server_error)

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to