Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

undefined method `last' for #<Classname> #660

Closed
TimothyKlim opened this Issue Aug 19, 2011 · 13 comments

Comments

Projects
None yet
3 participants
Contributor

TimothyKlim commented Aug 19, 2011

Hi! I used lastest formtastic and got error: undefined method `last' for #Soundtrack:0x00000101c5e4f8

label Soundtracks:
= semantic_form_for @product, url: line_items_path, method: 'post' do |f|
  = f.input :soundtracks, :as => :check_boxes, :collection => @product.soundtracks.map { |item| [item.title, item.guid] }, label: false

  = f.submit 'Buy'

but in 1.* version is works fine.

Gemfile:

gem 'rails', '~> 3.1.0.rc'
gem 'formtastic', git: 'git://github.com/justinfrench/formtastic.git'

Ruby: ruby 1.9.3dev (2011-07-31 revision 32789) [x86_64-darwin10.8.0]

Thanks for project!

Contributor

TimothyKlim commented Aug 19, 2011

# db/schema.rb
# ...
create_table "soundtracks", :force => true do |t|
  t.string   "title"
  t.string   "guid"
  # ...
end
Contributor

TimothyKlim commented Aug 19, 2011

or if I use this:

  = f.input :soundtracks, :as => :check_boxes

then I have no error, but I got all of soundtracks(Sountrack.all) instead @product.soundtracks.

Collaborator

sobrinho commented Aug 19, 2011

Could you post de full backtrace?

Contributor

TimothyKlim commented Aug 19, 2011

Hi! yep

activemodel (3.1.0.rc6) lib/active_model/attribute_methods.rb:385:in `method_missing'
activerecord (3.1.0.rc6) lib/active_record/attribute_methods.rb:60:in `method_missing'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/base/collections.rb:87:in `send_or_call'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/base/collections.rb:95:in `send_or_call_or_object'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:157:in `block in selected_values'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:157:in `map'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:157:in `selected_values'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:147:in `checked?'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:141:in `check_box_without_hidden_input'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:105:in `choice_html'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:93:in `block (5 levels) in to_html'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
haml (3.1.2) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `capture'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:104:in `capture_with_haml'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/base/choices.rb:30:in `choice_wrapping'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:92:in `block (4 levels) in to_html'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:91:in `map'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:91:in `block (3 levels) in to_html'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
haml (3.1.2) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `capture'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:104:in `capture_with_haml'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/base/choices.rb:19:in `choices_group_wrapping'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:90:in `block (2 levels) in to_html'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
haml (3.1.2) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `capture'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:104:in `capture_with_haml'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/base/choices.rb:8:in `choices_wrapping'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:87:in `block in to_html'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
haml (3.1.2) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `capture'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:104:in `capture_with_haml'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/base/wrapping.rb:11:in `input_wrapping'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/inputs/check_boxes_input.rb:86:in `to_html'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/helpers/input_helper.rb:265:in `input'
app/views/albums/_album.html.slim:19:in `block in _app_views_albums__album_html_slim___4102609391774070795_2162760800'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
haml (3.1.2) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
actionpack (3.1.0.rc6) lib/action_view/helpers/capture_helper.rb:40:in `capture'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:104:in `capture_with_haml'
actionpack (3.1.0.rc6) lib/action_view/helpers/form_helper.rb:590:in `fields_for'
actionpack (3.1.0.rc6) lib/action_view/helpers/form_helper.rb:373:in `form_for'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:181:in `form_for_with_haml'
haml (3.1.2) lib/haml/helpers/xss_mods.rb:132:in `form_for_with_haml_xss'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/helpers/form_helper.rb:161:in `block in semantic_form_for'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/helpers/form_helper.rb:192:in `with_custom_field_error_proc'
/Users/timothyklim/.rvm/gems/ruby-1.9.3-preview1/bundler/gems/formtastic-a95479e0078d/lib/formtastic/helpers/form_helper.rb:160:in `semantic_form_for'
app/views/albums/_album.html.slim:15:in `_app_views_albums__album_html_slim___4102609391774070795_2162760800'
actionpack (3.1.0.rc6) lib/action_view/template.rb:144:in `block in render'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.0.rc6) lib/action_view/template.rb:142:in `render'
actionpack (3.1.0.rc6) lib/action_view/renderer/partial_renderer.rb:256:in `render_partial'
actionpack (3.1.0.rc6) lib/action_view/renderer/partial_renderer.rb:228:in `block (2 levels) in render'
actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:33:in `block in instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument'
actionpack (3.1.0.rc6) lib/action_view/renderer/partial_renderer.rb:227:in `block in render'
actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
actionpack (3.1.0.rc6) lib/action_view/renderer/partial_renderer.rb:219:in `render'
actionpack (3.1.0.rc6) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.1.0.rc6) lib/action_view/helpers/rendering_helper.rb:27:in `render'
haml (3.1.2) lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml'
app/views/products/show.html.slim:1:in `_app_views_products_show_html_slim__2843369224793766788_2175615380'
actionpack (3.1.0.rc6) lib/action_view/template.rb:144:in `block in render'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:55:in `instrument'
actionpack (3.1.0.rc6) lib/action_view/template.rb:142:in `render'
actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:40:in `block (2 levels) in render_template'
actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:33:in `block in instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:33:in `instrument'
actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:39:in `block in render_template'
actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:47:in `render_with_layout'
actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:38:in `render_template'
actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:12:in `block in render'
actionpack (3.1.0.rc6) lib/action_view/renderer/abstract_renderer.rb:22:in `wrap_formats'
actionpack (3.1.0.rc6) lib/action_view/renderer/template_renderer.rb:9:in `render'
actionpack (3.1.0.rc6) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.1.0.rc6) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:120:in `_render_template'
actionpack (3.1.0.rc6) lib/action_controller/metal/streaming.rb:250:in `_render_template'
actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:114:in `render_to_body'
actionpack (3.1.0.rc6) lib/action_controller/metal/renderers.rb:30:in `render_to_body'
actionpack (3.1.0.rc6) lib/action_controller/metal/compatibility.rb:43:in `render_to_body'
actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:99:in `render'
actionpack (3.1.0.rc6) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.1.0.rc6) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Users/timothyklim/.rvm/rubies/ruby-1.9.3-preview1/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.1.0.rc6) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.1.0.rc6) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.1.0.rc6) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.1.0.rc6) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.1.0.rc6) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.1.0.rc6) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.1.0.rc6) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.1.0.rc6) lib/active_support/callbacks.rb:416:in `_run__2588875315221258788__process_action__3183525345477550736__callbacks'
activesupport (3.1.0.rc6) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.0.rc6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc6) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.0.rc6) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.0.rc6) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.0.rc6) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.0.rc6) lib/action_controller/metal/params_wrapper.rb:202:in `process_action'
activerecord (3.1.0.rc6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.0.rc6) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.0.rc6) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.0.rc6) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.0.rc6) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.0.rc6) lib/action_controller/metal.rb:236:in `block in action'
actionpack (3.1.0.rc6) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.0.rc6) lib/action_dispatch/routing/route_set.rb:29:in `call'
rack-mount (0.8.2) lib/rack/mount/route_set.rb:152:in `block in call'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:96:in `block in recognize'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:110:in `optimized_each'
rack-mount (0.8.2) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.2) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/routing/route_set.rb:531:in `call'
sass (3.1.7) lib/sass/plugin/rack.rb:54:in `call'
lib/suggests_proxy.rb:21:in `call'
warden (1.0.5) lib/warden/manager.rb:35:in `block in call'
warden (1.0.5) lib/warden/manager.rb:34:in `catch'
warden (1.0.5) lib/warden/manager.rb:34:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.2) lib/rack/etag.rb:23:in `call'
rack (1.3.2) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/flash.rb:243:in `call'
rack (1.3.2) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.2) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/cookies.rb:326:in `call'
activerecord (3.1.0.rc6) lib/active_record/query_cache.rb:62:in `call'
activerecord (3.1.0.rc6) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.0.rc6) lib/active_support/callbacks.rb:401:in `_run_call_callbacks'
activesupport (3.1.0.rc6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.2) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.0.rc6) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.2) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.0.rc6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.2) lib/rack/lock.rb:15:in `call'
actionpack (3.1.0.rc6) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.0.rc6) lib/rails/engine.rb:455:in `call'
railties (3.1.0.rc6) lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:146:in `handle'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:99:in `rescue in block (2 levels) in start'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:96:in `block (2 levels) in start'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:86:in `each'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:86:in `block in start'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:66:in `loop'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:66:in `start'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:13:in `run'
/Users/timothyklim/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/bin/nack_worker:4:in `<main>'
Owner

justinfrench commented Aug 19, 2011

Can you please re-bundle from master to ensure you have the very latest Formtastic code? This should help ensure you ahv the latest ref:

gem 'formtastic', git: 'git://github.com/justinfrench/formtastic.git', :ref => 'c64f967'

There was some work done around send_or_call in between rc3 and rc4 of Formtastic, so knowing that you have the latest code will help narrow down if this is "fixed" or a new regression.

Also wouldn't hurt to grab the latest Rails rc6, but I don't believe it's the cause.

Contributor

TimothyKlim commented Aug 19, 2011

Yep, I'm use the latest code from master branch and the error still exists.

$ bundle show|pbcopy

Gems included by the bundle:
  * actionmailer (3.1.0.rc6)
  * actionpack (3.1.0.rc6)
  * activemodel (3.1.0.rc6)
  * activerecord (3.1.0.rc6)
  * activeresource (3.1.0.rc6)
  * activesupport (3.1.0.rc6)
  * addressable (2.2.6)
  * ansi (1.3.0)
  * arel (2.2.1)
  * bcrypt-ruby (2.1.4)
  * builder (3.0.0)
  * bundler (1.1.pre.5)
  * capybara (1.0.1)
  * capybara-firebug (0.0.9 5fda4e2)
  * carrierwave (0.5.7)
  * childprocess (0.2.1)
  * chunky_png (1.2.1)
  * ckeditor (3.6.0)
  * coffee-rails (3.1.0.rc.6)
  * coffee-script (2.2.0)
  * coffee-script-source (1.1.2)
  * compass (0.11.5)
  * configuration (1.3.1)
  * cucumber (1.0.2)
  * cucumber-rails (1.0.2)
  * database_cleaner (0.6.7)
  * devise (1.4.2)
  * diff-lcs (1.1.2)
  * em-dir-watcher (0.9.4)
  * em-websocket (0.3.1)
  * erubis (2.7.0)
  * eventmachine (0.12.10)
  * execjs (1.2.4)
  * fabrication (1.0.1)
  * ffaker (1.8.0)
  * ffi (1.0.9)
  * formtastic (2.0.0.rc4 c64f967)
  * fssm (0.2.7)
  * gherkin (2.4.11)
  * growl (1.0.3)
  * guard (0.6.2)
  * guard-bundler (0.1.3)
  * guard-cucumber (0.6.1)
  * guard-livereload (0.3.0)
  * guard-pow (0.1.0)
  * guard-rspec (0.4.2)
  * guid (0.1.1)
  * haml (3.1.2)
  * hike (1.2.1)
  * i18n (0.6.0)
  * jquery-rails (1.0.13)
  * json (1.5.3)
  * json_pure (1.5.3)
  * kaminari (0.12.4)
  * kgio (2.6.0)
  * launchy (0.4.0)
  * libv8 (3.3.10.2)
  * livereload (1.6)
  * mail (2.3.0)
  * mechanize (2.0.1)
  * mime-types (1.16)
  * multi_json (1.0.3)
  * net-http-digest_auth (1.1.1)
  * net-http-persistent (1.8.1)
  * nokogiri (1.5.0)
  * orm_adapter (0.0.5)
  * pg (0.11.0)
  * polyglot (0.3.2)
  * populator (1.0.0 cd1373d)
  * rack (1.3.2)
  * rack-cache (1.0.2)
  * rack-mount (0.8.2)
  * rack-ssl (1.3.2)
  * rack-test (0.6.1)
  * rails (3.1.0.rc6)
  * rails_admin (0.0.1 f02f7c7)
  * railties (3.1.0.rc6)
  * raindrops (0.7.0)
  * rake (0.9.2)
  * rb-fsevent (0.4.3.1)
  * rdoc (3.9.2)
  * rmagick (2.13.1)
  * rspec (2.6.0)
  * rspec-core (2.6.4)
  * rspec-expectations (2.6.0)
  * rspec-mocks (2.6.0)
  * rspec-rails (2.6.1)
  * ruby-json (1.1.2)
  * rubyzip (0.9.4)
  * sass (3.1.7)
  * sass-rails (3.1.0.rc.6)
  * selenium-webdriver (2.4.0)
  * slim (1.0.1)
  * sprockets (2.0.0.beta.13)
  * temple (0.3.2)
  * term-ansicolor (1.0.6)
  * therubyracer (0.9.3)
  * thor (0.14.6)
  * tilt (1.3.2)
  * treetop (1.4.10)
  * turn (0.8.2)
  * tzinfo (0.3.29)
  * uglifier (1.0.1)
  * unicorn (4.0.1)
  * warden (1.0.5)
  * webrobots (0.0.11)
  * xpath (0.1.4)
Owner

justinfrench commented Aug 22, 2011

So I'm wondering if my work in 7afcf0f affected this (it was done after 2.0.0.rc3). I've pushed a new branch GH660 with this patch reverted. If you could bundle this branch, restart, and try again, that'd help a lot in narrowing this down:

gem 'formtastic', git: 'git://github.com/justinfrench/formtastic.git', :branch => '7afcf0f'
Owner

justinfrench commented Aug 22, 2011

It could also be 1.9.3-related. Any chance you can spin up an RVM with REE or 187 temporarily to try and narrow this down?

Has Formtastic 2 worked for you at all (did 2.0.0.rc3 work for you) or...?

Contributor

TimothyKlim commented Aug 23, 2011

yep, bug still exists.
I created repo with same bug: https://github.com/TimothyKlim/formtastic_test_for

Owner

justinfrench commented Aug 23, 2011

Ok, no idea why that's failing yet, but I think albums/index.html.erb can safely be changed to this, to meet the same requirements and functionality:

<%= f.input :soundtracks, :as => :check_boxes, :collection => @album.soundtracks, :label_method => :title %>

Does this help in your full app? Will still hunt for the root cause and leave this open for a bit.

Contributor

TimothyKlim commented Aug 24, 2011

Yep, this is works perfectly.
But, when I used formtastic 1.4, this code(issue) is worked too.

Thanks!

Owner

justinfrench commented Aug 30, 2011

The root of this seems to be that :collection is an Array of Arrays of Strings ([[label, value], [label, value]]), yet @product.soundtracks returns an array of Soundtrack objects. Formtastic is trying to call last on a Soundtrack because it's trying to compare it to an Array [label, value]. last is being called because of the arrays present in :collection.

Not really sure how to code around this (I'm sure it can be done if it was somehow supported in 1.x), or even if I should. It feels more like a case where an exception should be raised that the collection needs to be an array of objects when the method is an AR association. In other words, the format of the collection is not appropriate for the input and it's association.

Thoughts?

Collaborator

sobrinho commented Aug 31, 2011

Fix was sent in #665, closing.

@sobrinho sobrinho closed this Aug 31, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment