Closed 4ware closed 12 years ago
Can you give a backtrace? I can't reproduce the problem.
Yep. By the way, the following doesn't work either:
= f.collection_select :client_id, Contact.is_client.order_by(:last_name.asc, :first_name.asc), :id, :name
Here is your backtrace for the first problem:
ActionView::Template::Error (can't convert Symbol into String):
1: = twitter_bootstrap_form_for(@track) do |f|
2: = f.hidden_field :user_id, :value => current_user.id
3: = f.inputs "Eintrag" do
4: = f.date_select :starts_at, "Anfang"
5: = f.text_field :ends_at, "Ende"
6: = f.actions do
7: =f.submit "erstellen"
app/views/timetrackings/_form.slim:4:in `block (2 levels) in _app_views_timetrackings__form_slim__2940875084335130739_70259333716820'
app/views/timetrackings/_form.slim:3:in `block in _app_views_timetrackings__form_slim__2940875084335130739_70259333716820'
app/views/timetrackings/_form.slim:1:in `_app_views_timetrackings__form_slim__2940875084335130739_70259333716820'
app/views/timetrackings/index.html.slim:6:in `_app_views_timetrackings_index_html_slim__234356866407762948_70259308334340'
The second parameter for input types is overridden to be the label.
= f.collection_select :client_id, 'Client', Contact.is_client.order_by(:last_name.asc, :first_name.asc), :id, :name
For your date_select problem, I need the full stack trace, not just the application trace. I need to know where the problem occurred inside the plugin. However, that exact example works for me.
Here we go:
actionpack (3.1.1) lib/action_view/helpers/date_helper.rb:681:in `include?'
actionpack (3.1.1) lib/action_view/helpers/date_helper.rb:681:in `select_date'
actionpack (3.1.1) lib/action_view/helpers/date_helper.rb:971:in `to_date_select_tag'
actionpack (3.1.1) lib/action_view/helpers/date_helper.rb:216:in `date_select'
actionpack (3.1.1) lib/action_view/helpers/date_helper.rb:1027:in `date_select'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:85:in `block (4 levels) in <class:FormBuilder>'
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.3) 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.3) lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
actionpack (3.1.1) lib/action_view/helpers/tag_helper.rb:91:in `content_tag'
haml (3.1.3) lib/haml/helpers/action_view_mods.rb:115:in `content_tag_with_haml'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:84:in `block (3 levels) in <class:FormBuilder>'
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.3) 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.3) lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
actionpack (3.1.1) lib/action_view/helpers/tag_helper.rb:91:in `content_tag'
haml (3.1.3) lib/haml/helpers/action_view_mods.rb:115:in `content_tag_with_haml'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:117:in `div_wrapper'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:82:in `block (2 levels) in <class:FormBuilder>'
app/views/timetrackings/_form.slim:4:in `block (2 levels) in _app_views_timetrackings__form_slim___197374508430060479_70179054625480'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:38:in `call'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:38:in `block in inputs'
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.3) 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.3) lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
actionpack (3.1.1) lib/action_view/helpers/tag_helper.rb:91:in `content_tag'
haml (3.1.3) lib/haml/helpers/action_view_mods.rb:115:in `content_tag_with_haml'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_builder.rb:36:in `inputs'
app/views/timetrackings/_form.slim:3:in `block in _app_views_timetrackings__form_slim___197374508430060479_70179054625480'
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.3) 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.3) 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.3) lib/haml/helpers/action_view_mods.rb:182:in `form_for_with_haml'
haml (3.1.3) lib/haml/helpers/xss_mods.rb:132:in `form_for_with_haml_xss'
twitter_bootstrap_form_for (1.0.2) lib/twitter_bootstrap_form_for/form_helpers.rb:12:in `block (3 levels) in <module:FormHelpers>'
app/views/timetrackings/_form.slim:1:in `_app_views_timetrackings__form_slim___197374508430060479_70179054625480'
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.3) lib/haml/helpers/action_view_mods.rb:13:in `render_with_haml'
app/views/timetrackings/index.html.slim:6:in `_app_views_timetrackings_index_html_slim___2654237251947784770_70179055123160'
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/kai/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:310: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'
actionpack (3.1.1) lib/action_controller/metal/instrumentation.rb:39:in `render'
app/controllers/timetrackings_controller.rb:13:in `for_date'
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:425:in `_run__1323199279173521366__process_action__1248892712173513649__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'
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'
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'
mongoid (2.3.3) lib/rack/mongoid/middleware/identity_map.rb:33:in `block in call'
mongoid (2.3.3) lib/mongoid.rb:132:in `unit_of_work'
mongoid (2.3.3) lib/rack/mongoid/middleware/identity_map.rb:33:in `call'
pdfkit (0.5.2) lib/pdfkit/middleware.rb:16:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) 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.5) lib/rack/etag.rb:23:in `call'
rack (1.3.5) 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.5) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.5) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.1) lib/action_dispatch/middleware/cookies.rb:331: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.5) 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.5) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.5) 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'
thin (1.2.11) lib/thin/connection.rb:84:in `block in pre_process'
thin (1.2.11) lib/thin/connection.rb:82:in `catch'
thin (1.2.11) lib/thin/connection.rb:82:in `pre_process'
thin (1.2.11) lib/thin/connection.rb:57:in `process'
thin (1.2.11) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.2.11) lib/thin/backends/base.rb:61:in `start'
thin (1.2.11) lib/thin/server.rb:159:in `start'
rack (1.3.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.3.5) lib/rack/server.rb:265:in `start'
railties (3.1.1) lib/rails/commands/server.rb:70:in `start'
railties (3.1.1) lib/rails/commands.rb:54:in `block in <top (required)>'
railties (3.1.1) lib/rails/commands.rb:49:in `tap'
railties (3.1.1) lib/rails/commands.rb:49:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
This doesn't look to be caused by my gem.
From:
actionpack (3.1.1) lib/action_view/helpers/date_helper.rb:681:in `include?'
def date_order
@options[:order] || translated_date_order
end
def translated_date_order
I18n.translate(:'date.order', :locale => @options[:locale]) || []
end
def select_date
order = date_order.dup
...
@options[:discard_year] ||= true unless order.include?(:year)
end
The exception is being raised when include?(:year)
is called on order
, which is coming out of the translation stack. It expects the value to be an Array of Symbols, and I suspect that you have made them into an Array of Strings somewhere.
Okay :) As follows: the form is called with a new instance of the following model:
class Timetracking include Mongoid::Document include Mongoid::MultiParameterAttributes field :starts_at, :type => DateTime field :ends_at, :type => DateTime
belongs_to :user belongs_to :client, :class_name => 'Contact'
scope :for_user, lambda{|user_id| where(:user_id => user_id)} scope :for_today, where(:starts_at.gte => Date.today.beginning_of_day.utc, :ends_at.lte => Date.today.end_of_day.utc) scope :for, ->(date) { where(:starts_at.gte => date.beginning_of_day.utc, :ends_at.lte => date.end_of_day.utc)}
def duration Time.at(self.ends_at.to_time - self.starts_at.to_time).gmtime.strftime('%R') end end
The given date is: 2011-11-13T13:15:00+00:00
Check the above comment. I submitted too early, then dug deeper and reedited it. I don''t think this is being caused by my gem, but instead is from a misconfiguration on your translation stack.
I suspect if you use a date_select
inside a standard form_for
, you will have this problem as well.
I'll look at it and inform you about my findings. Thanks!
Yep. It seems i've got a misconfiguration in my locale... Damn. Thanks!
Hi!
When i try to use a f.date_select i get an "can't convert Symbol into String". What gives?