I have the following form with Formtastic:
= semantic_form_for @user, :url=> url_for(register_path), :html => {:id => "registration_form"} do |f|
= f.inputs :name => "Addresses", :id=> "addresses" do
= f.fields_for :addresses do |a|
%li.address
%ol
= a.input :street
= a.link_to_remove "Remove address"
#add_address
= f.link_to_add "New Address", :addresses
我遇到了下面的错误: undefined method `link_to_remove' for #
无论我使用`semantic_fields_for`还是`fields_for`都没有关系。
另外,我正在使用Github上的代码(据说已经解决了这个问题),而不是发布的gem包。
gem "nested_form", :git => "git://github.com/ryanb/nested_form.git"
任何帮助都将不胜感激,我正在这里烦恼不已 :/
谢谢!
堆栈跟踪
app/views/shared/_address_fields.html.haml:9:in `_app_views_shared__address_fields_html_haml___4308950470074423288_2167792580' actionpack (3.1.1) lib/action_view/template.rb:144:in `block in render' activesupport (3.1.1) lib/active_support/notifications.rb:55:in `instrument' actionpack (3.1.1) lib/action_view/template.rb:142:in `render' actionpack (3.1.1) lib/action_view/renderer/partial_renderer.rb:256:in `render_partial' actionpack (3.1.1) lib/action_view/renderer/partial_renderer.rb:228:in `block (2 levels) in render' actionpack (3.1.1) lib/action_view/renderer/abstract_renderer.rb:33:in `block in instrument' activesupport (3.1.1) lib/active_support/notifications.rb:53:in `block in instrument' activesupport (3.1.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.1.1) lib/active_support/notifications.rb:53:in `instrument' actionpack (3.1.1) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument' actionpack (3.1.1) lib/action_view/renderer/partial_renderer.rb:227:in `block in render' actionpack (3.1.1) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats' actionpack (3.1.1) lib/action_view/renderer/partial_renderer.rb:219:in `render' actionpack (3.1.1) lib/action_view/renderer/renderer.rb:41:in `render_partial' actionpack (3.1.1) lib/action_view/renderer/renderer.rb:15:in `render' actionpack (3.1.1) lib/action_view/helpers/rendering_helper.rb:24:in `render' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:11:in `block in render_with_haml' haml (3.1.4) lib/haml/helpers.rb:90:in `non_haml' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:11:in `render_with_haml' app/views/user/registrations/new.html.haml:17:in `block (3 levels) in _app_views_user_registrations_new_html_haml___2562073157518560036_2193979060' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:93:in `block in capture_with_haml' haml (3.1.4) lib/haml/helpers.rb:345:in `call' haml (3.1.4) lib/haml/helpers.rb:345:in `block in capture_haml' haml (3.1.4) lib/haml/helpers.rb:569:in `with_haml_buffer' haml (3.1.4) lib/haml/helpers.rb:341:in `capture_haml' haml (3.1.4) lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:93:in `capture_with_haml' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:590:in `fields_for' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:1393:in `fields_for_nested_model' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:1379:in `block in fields_for_with_nested_attributes' activerecord (3.1.1) lib/active_record/associations/collection_proxy.rb:91:in `each' activerecord (3.1.1) lib/active_record/associations/collection_proxy.rb:91:in `method_missing' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:1378:in `fields_for_with_nested_attributes' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:1261:in `fields_for' formtastic (2.0.2) lib/formtastic/form_builder.rb:79:in `semantic_fields_for' app/views/user/registrations/new.html.haml:16:in `block (2 levels) in _app_views_user_registrations_new_html_haml___2562073157518560036_2193979060' haml (3.1.4) lib/haml/helpers.rb:345:in `call' haml (3.1.4) lib/haml/helpers.rb:345:in `block in capture_haml' haml (3.1.4) lib/haml/helpers.rb:569:in `with_haml_buffer' haml (3.1.4) lib/haml/helpers.rb:341:in `capture_haml' haml (3.1.4) lib/haml/helpers/xss_mods.rb:61:in `capture_haml_with_haml_xss' formtastic (2.0.2) lib/formtastic/helpers/fieldset_wrapper.rb:34:in `field_set_and_list_wrapping' formtastic (2.0.2) lib/formtastic/helpers/inputs_helper.rb:292:in `inputs' app/views/user/registrations/new.html.haml:15:in `block in _app_views_user_registrations_new_html_haml___2562073157518560036_2193979060' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:181:in `call' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:181:in `block (2 levels) in form_for_with_haml' haml (3.1.4) lib/haml/helpers.rb:255:in `with_tabs' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:181:in `block in form_for_with_haml' actionpack (3.1.1) lib/action_view/helpers/capture_helper.rb:40:in `block in capture' actionpack (3.1.1) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer' haml (3.1.4) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss' actionpack (3.1.1) lib/action_view/helpers/capture_helper.rb:40:in `capture' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:590:in `fields_for' actionpack (3.1.1) lib/action_view/helpers/form_helper.rb:373:in `form_for' haml (3.1.4) lib/haml/helpers/action_view_mods.rb:183:in `form_for_with_haml' haml (3.1.4) lib/haml/helpers/xss_mods.rb:132:in `form_for_with_haml_xss' formtastic (2.0.2) lib/formtastic/helpers/form_helper.rb:161:in `block in semantic_form_for' formtastic (2.0.2) lib/formtastic/helpers/form_helper.rb:192:in `with_custom_field_error_proc' formtastic (2.0.2) lib/formtastic/helpers/form_helper.rb:160:in `semantic_form_for' app/views/user/registrations/new.html.haml:6:in `_app_views_user_registrations_new_html_haml___2562073157518560036_2193979060' actionpack (3.1.1) lib/action_view/template.rb:144:in `block in render' activesupport (3.1.1) lib/active_support/notifications.rb:55:in `instrument' actionpack (3.1.1) lib/action_view/template.rb:142:in `render' actionpack (3.1.1) lib/action_view/renderer/template_renderer.rb:40:in `block (2 levels) in render_template' actionpack (3.1.1) lib/action_view/renderer/abstract_renderer.rb:33:in `block in instrument' activesupport (3.1.1) lib/active_support/notifications.rb:53:in `block in instrument' activesupport (3.1.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.1.1) lib/active_support/notifications.rb:53:in `instrument' actionpack (3.1.1) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument' actionpack (3.1.1) lib/action_view/renderer/template_renderer.rb:39:in `block in render_template' actionpack (3.1.1) lib/action_view/renderer/template_renderer.rb:47:in `render_with_layout' actionpack (3.1.1) lib/action_view/renderer/template_renderer.rb:38:in `render_template' actionpack (3.1.1) lib/action_view/renderer/template_renderer.rb:12:in `block in render' actionpack (3.1.1) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats' actionpack (3.1.1) lib/action_view/renderer/template_renderer.rb:9:in `render' actionpack (3.1.1) lib/action_view/renderer/renderer.rb:36:in `render_template' actionpack (3.1.1) lib/action_view/renderer/renderer.rb:17:in `render' actionpack (3.1.1) lib/abstract_controller/rendering.rb:120:in `_render_template' actionpack (3.1.1) lib/action_controller/metal/streaming.rb:250:in `_render_template' actionpack (3.1.1) lib/abstract_controller/rendering.rb:114:in `render_to_body' actionpack (3.1.1) lib/action_controller/metal/renderers.rb:30:in `render_to_body' actionpack (3.1.1) lib/action_controller/metal/compatibility.rb:43:in `render_to_body' actionpack (3.1.1) lib/abstract_controller/rendering.rb:99:in `render' actionpack (3.1.1) lib/action_controller/metal/rendering.rb:16:in `render' actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render' activesupport (3.1.1) lib/active_support/core_ext/benchmark.rb:5:in `block in ms' /Users/chance/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/benchmark.rb:309:in `realtime' activesupport (3.1.1) lib/active_support/core_ext/benchmark.rb:5:in `ms' actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:40:in `block in render' actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime' activerecord (3.1.1) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime' actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:39:in `render' devise (1.5.2) lib/devise/controllers/scoped_views.rb:28:in `render_with_scope' devise (1.5.2) app/controllers/devise/registrations_controller.rb:9:in `block in new' actionpack (3.1.1) lib/action_controller/metal/responder.rb:231:in `call' actionpack (3.1.1) lib/action_controller/metal/responder.rb:231:in `default_render' actionpack (3.1.1) lib/action_controller/metal/responder.rb:160:in `to_html' actionpack (3.1.1) lib/action_controller/metal/responder.rb:153:in `respond' actionpack (3.1.1) lib/action_controller/metal/responder.rb:146:in `call' actionpack (3.1.1) lib/action_controller/metal/mime_responds.rb:238:in `respond_with' devise (1.5.2) lib/devise/controllers/internal_helpers.rb:148:in `respond_with_navigational' devise (1.5.2) app/controllers/devise/registrations_controller.rb:9:in `new' app/controllers/user/registrations_controller.rb:3:in `new' actionpack (3.1.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (3.1.1) lib/abstract_controller/base.rb:167:in `process_action' actionpack (3.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action' actionpack (3.1.1) lib/abstract_controller/callbacks.rb:18:in `block in process_action' activesupport (3.1.1) lib/active_support/callbacks.rb:434:in `_run__1640754455416320338__process_action__2506477701008906327__callbacks' activesupport (3.1.1) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks' activesupport (3.1.1) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (3.1.1) lib/abstract_controller/callbacks.rb:17:in `process_action' actionpack (3.1.1) lib/action_controller/metal/rescue.rb:17:in `process_action' actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' activesupport (3.1.1) lib/active_support/notifications.rb:53:in `block in instrument' activesupport (3.1.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument' activesupport (3.1.1) lib/active_support/notifications.rb:53:in `instrument' actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action' actionpack (3.1.1) lib/action_controller/metal/params_wrapper.rb:201:in `process_action' activerecord (3.1.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action' actionpack (3.1.1) lib/abstract_controller/base.rb:121:in `process' actionpack (3.1.1) lib/abstract_controller/rendering.rb:45:in `process' actionpack (3.1.1) lib/action_controller/metal.rb:193:in `dispatch' actionpack (3.1.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' actionpack (3.1.1) lib/action_controller/metal.rb:236:in `block in action' actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:65:in `call' actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:65:in `dispatch' actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:29:in `call' actionpack (3.1.1) lib/action_dispatch/routing/mapper.rb:41:in `call' rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in `optimized_each' rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize' rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call' actionpack (3.1.1) lib/action_dispatch/routing/route_set.rb:532:in `call' warden (1.1.0) lib/warden/manager.rb:35:in `block in call' warden (1.1.0) lib/warden/manager.rb:34:in `catch' warden (1.1.0) lib/warden/manager.rb:34:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' rack (1.3.3) lib/rack/etag.rb:23:in `call' rack (1.3.3) lib/rack/conditionalget.rb:25:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/head.rb:14:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/flash.rb:243:in `call' rack (1.3.3) lib/rack/session/abstract/id.rb:195:in `context' rack (1.3.3) lib/rack/session/abstract/id.rb:190:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/cookies.rb:331:in `call' activerecord (3.1.1) lib/active_record/query_cache.rb:62:in `call' activerecord (3.1.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' activesupport (3.1.1) lib/active_support/callbacks.rb:392:in `_run_call_callbacks' activesupport (3.1.1) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (3.1.1) lib/action_dispatch/middleware/callbacks.rb:28:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/reloader.rb:68:in `call' rack (1.3.3) lib/rack/sendfile.rb:101:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call' railties (3.1.1) lib/rails/rack/logger.rb:13:in `call' rack (1.3.3) lib/rack/methodoverride.rb:24:in `call' rack (1.3.3) lib/rack/runtime.rb:17:in `call' rack (1.3.3) lib/rack/lock.rb:15:in `call' actionpack (3.1.1) lib/action_dispatch/middleware/static.rb:53:in `call' railties (3.1.1) lib/rails/engine.rb:456:in `call' railties (3.1.1) lib/rails/rack/content_length.rb:16:in `call' railties (3.1.1) lib/rails/rack/log_tailer.rb:14:in `call' rack (1.3.3) lib/rack/handler/webrick.rb:59:in `service'
Gemfile.lock
GIT remote: git://github.com/haines/nested_form.git revision: a0f78ca877a10055f10bd7d9db972432c6be90ae specs: nested_form (0.1.1)
GEM remote: http://rubygems.org/ specs: actionmailer (3.1.1) actionpack (= 3.1.1) mail (~> 2.3.0) actionpack (3.1.1) activemodel (= 3.1.1) activesupport (= 3.1.1) builder (~> 3.0.0) erubis (~> 2.7.0) i18n (~> 0.6) rack (~> 1.3.2) rack-cache (~> 1.1) rack-mount (~> 0.8.2) rack-test (~> 0.6.1) sprockets (~> 2.0.2) activemodel (3.1.1) activesupport (= 3.1.1) builder (~> 3.0.0) i18n (~> 0.6) activerecord (3.1.1) activemodel (= 3.1.1) activesupport (= 3.1.1) arel (~> 2.2.1) tzinfo (~> 0.3.29) activeresource (3.1.1) activemodel (= 3.1.1) activesupport (= 3.1.1) activesupport (3.1.1) multi_json (~> 1.0) addressable (2.2.6) arel (2.2.1) bcrypt-ruby (3.0.1) builder (3.0.0) cancan (1.6.7) cantango (0.9.4.7) cancan (>= 1.4) hashie (>= 0.4) rails (>= 3.0.1) sugar-high (>= 0.6.0) sweetloader (~> 0.1.0) capybara (1.1.2) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 0.1.4) childprocess (0.2.3) ffi (~> 1.0.6) cocaine (0.2.0) coffee-rails (3.1.1) coffee-script (>= 2.2.0) railties (~> 3.1.0) coffee-script (2.2.0) coffee-script-source execjs coffee-script-source (1.1.3) cucumber (1.1.4) builder (>= 2.1.2) diff-lcs (>= 1.1.2) gherkin (~> 2.7.1) json (>= 1.4.6) term-ansicolor (>= 1.0.6) cucumber-rails (1.2.1) capybara (>= 1.1.2) cucumber (>= 1.1.3) nokogiri (>= 1.5.0) database_cleaner (0.7.0) devise (1.5.2) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) warden (~> 1.1) diff-lcs (1.1.3) em-websocket (0.3.5) addressable (>= 2.1.1) eventmachine (>= 0.12.9) erubis (2.7.0) eventmachine (0.12.10) execjs (1.2.12) multi_json (~> 1.0) factory_girl (2.3.2) activesupport factory_girl_rails (1.4.0) factory_girl (~> 2.3.0) railties (>= 3.0.0) ffi (1.0.11) formtastic (2.0.2) rails (~> 3.0) friendly_id (4.0.0.beta14) frontend-helpers (0.1.1) haml-rails rails (~> 3.1.0) sass-rails sprockets geocoder (1.1.0) geonames (0.2.2) gherkin (2.7.1) json (>= 1.4.6) growl (1.0.3) guard (0.8.8) thor (~> 0.14.6) guard-bundler (0.1.3) bundler (>= 1.0.0) guard (>= 0.2.2) guard-cucumber (0.7.4) cucumber (>= 0.10) guard (>= 0.8.3) guard-livereload (0.3.1) em-websocket (>= 0.2.0) guard (>= 0.4.0) multi_json (~> 1.0.3) guard-rails (0.0.3) guard (>= 0.2.2) guard-rspec (0.5.9) guard (>= 0.8.4) haml (3.1.4) haml-rails (0.3.4) actionpack (~> 3.0) activesupport (~> 3.0) haml (~> 3.0) railties (~> 3.0) hashie (1.2.0) hike (1.2.1) i18n (0.6.0) jquery-rails (1.0.19) railties (~> 3.0) thor (~> 0.14) json (1.6.3) launchy (2.0.5) addressable (~> 2.2.6) mail (2.3.0) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.17.2) multi_json (1.0.4) nokogiri (1.5.0) orm_adapter (0.0.5) paperclip (2.4.5) activerecord (>= 2.3.0) activesupport (>= 2.3.2) cocaine (>= 0.0.2) mime-types pg (0.12.0) rake-compiler (~> 0.7) polyamorous (0.5.0) activerecord (~> 3.0) polyglot (0.3.3) rack (1.3.3) rack-cache (1.1) rack (>= 0.4) rack-mount (0.8.3) rack (>= 1.0.0) rack-ssl (1.3.2) rack rack-test (0.6.1) rack (>= 1.0) rails (3.1.1) actionmailer (= 3.1.1) actionpack (= 3.1.1) activerecord (= 3.1.1) activeresource (= 3.1.1) activesupport (= 3.1.1) bundler (~> 1.0) railties (= 3.1.1) rails-footnotes (3.7.5) rails (>= 3.0.0) railties (3.1.1) actionpack (= 3.1.1) activesupport (= 3.1.1) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) rake-compiler (0.7.9) rake rb-fsevent (0.4.3.1) rdoc (3.11) json (~> 1.4) redis (2.2.2) redis-store (1.0.0.1) redis (~> 2.2.1) rest-client (1.6.7) mime-types (>= 1.16) rspec (2.7.0) rspec-core (~> 2.7.0) rspec-expectations (~> 2.7.0) rspec-mocks (~> 2.7.0) rspec-core (2.7.1) rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) rspec-mocks (2.7.0) rspec-rails (2.7.0) actionpack (~> 3.0) activesupport (~> 3.0) railties (~> 3.0) rspec (~> 2.7.0) rubyzip (0.9.5) sass (3.1.11) sass-rails (3.1.5) actionpack (~> 3.1.0) railties (~> 3.1.0) sass (~> 3.1.10) tilt (~> 1.3.2) selenium-webdriver (2.15.0) childprocess (>= 0.2.1) ffi (~> 1.0.9) multi_json (~> 1.0.4) rubyzip sprockets (2.0.3) hike (~> 1.2) rack (~> 1.0) tilt (!= 1.3.0, ~> 1.1) sqlite3 (1.3.5) squeel (0.9.3) activerecord (~> 3.0) activesupport (~> 3.0) polyamorous (~> 0.5.0) sugar-high (0.6.2.1) activesupport (>= 3.0.1) sweetloader (0.1.6) activesupport (>= 3.0.1) i18n term-ansicolor (1.0.7) thor (0.14.6) tilt (1.3.3) transloadit (1.0.2) json rest-client transloadit-rails (1.0.3) railties (~> 3) transloadit (>= 1.0.2) treetop (1.4.10) polyglot polyglot (>= 0.3.1) tzinfo (0.3.31) uglifier (1.1.0) execjs (>= 0.3.0) multi_json (>= 1.0.2) uuidtools (2.1.2) warden (1.1.0) rack (>= 1.0) xpath (0.1.4) nokogiri (~> 1.3)
PLATFORMS ruby
DEPENDENCIES cancan cantango capybara (>= 1.1.1) coffee-rails (~> 3.1.1) cucumber-rails (>= 1.1.1) database_cleaner (>= 0.6.7) devise (>= 1.4.7) factory_girl_rails (>= 1.2.0) formtastic friendly_id (~> 4.0.0.beta14) frontend-helpers geocoder geonames growl guard (>= 0.6.2) guard-bundler (>= 0.1.3) guard-cucumber (>= 0.6.1) guard-livereload (>= 0.3.0) guard-rails (>= 0.0.3) guard-rspec (>= 0.4.3) haml (>= 3.1.2) haml-rails (>= 0.3.4) jquery-rails launchy (>= 2.0.5) nested_form! paperclip (~> 2.4) pg rack (= 1.3.3) rails (= 3.1.1) rails-footnotes (>= 3.7) rb-fsevent redis redis-store rspec-rails (>= 2.6.1) sass-rails (~> 3.1.4) sqlite3 squeel transloadit-rails uglifier (>= 1.0.3) uuidtools
git://github.com/haines/nested_form.git
。 - Mikhail Nikalyukin