I'm trying to build a simple search form using the Ransack gem under rails. Though when using date_select, Ransack throws an NoMethodError for using 'day' on a '[2014,1,1]' String. Why is Ransack converting the Date Object to a String?
Here's my search form
<%= search_form_for #search, url: search_offer_path do |f| %>
<p>
<%= f.label :city_cont, "Choose City" %>
<%= f.text_field :city_cont %>
<%= f.label :available_dates_cont, "Choose Date" %>
<%= f.date_select :available_dates_cont %>
<%= f.label :available_times_cont, "Choose Time" %>
<%= f.time_select :available_times_cont %>
</p>
<p class="button"><%= f.submit "Search" %></p>
<% end %>
The fields :available_dates and :available_times contain hashes of multiple dates and times using the serializer
Thanks in advance
This is my error output:
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:821:in `block (2 levels) in <class:DateTimeSelector>'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:774:in `select_day'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:1025:in `block in build_selects_from_types'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:1023:in `each'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:1023:in `build_selects_from_types'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:723:in `select_date'
actionpack (4.0.2) lib/action_view/helpers/tags/date_select.rb:14:in `render'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:255:in `date_select'
actionpack (4.0.2) lib/action_view/helpers/date_helper.rb:1055:in `date_select'
app/views/offers/index_public.html.erb:7:in `block in _app_views_offers_index_public_html_erb__3128909028606137015_44602620'
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
actionpack (4.0.2) lib/action_view/helpers/capture_helper.rb:38:in `capture'
actionpack (4.0.2) lib/action_view/helpers/form_helper.rb:435:in `form_for'
ransack (1.1.0) lib/ransack/helpers/form_helper.rb:24:in `search_form_for'
app/views/offers/index_public.html.erb:1:in `_app_views_offers_index_public_html_erb__3128909028606137015_44602620'
actionpack (4.0.2) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.2) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.2) lib/action_view/template.rb:141:in `render'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
actionpack (4.0.2) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.2) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.2) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.2) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.2) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.2) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/Basti/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (4.0.2) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:40:in `render'
app/controllers/offers_controller.rb:52:in `index_public'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.2) lib/active_support/callbacks.rb:423:in `_run__162092440143471620__process_action__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.1.4) lib/omniauth/builder.rb:49:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.2) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.2) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `_run__174773027674768040__call__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.2) lib/rails/engine.rb:511:in `call'
railties (4.0.2) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
thin (1.6.1) lib/thin/connection.rb:82:in `block in pre_process'
thin (1.6.1) lib/thin/connection.rb:80:in `catch'
thin (1.6.1) lib/thin/connection.rb:80:in `pre_process'
thin (1.6.1) lib/thin/connection.rb:55:in `process'
thin (1.6.1) lib/thin/connection.rb:41:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.1) lib/thin/backends/base.rb:73:in `start'
thin (1.6.1) lib/thin/server.rb:162:in `start'
rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.2) lib/rack/server.rb:264:in `start'
railties (4.0.2) lib/rails/commands/server.rb:84:in `start'
railties (4.0.2) lib/rails/commands.rb:76:in `block in <top (required)>'
railties (4.0.2) lib/rails/commands.rb:71:in `tap'
railties (4.0.2) lib/rails/commands.rb:71:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Related
I try to add a "show" Interface for payments on Active Admin, so I added this code to my file "app/admin/payments.rb" :
ActiveAdmin.register Payment do
actions :index, :show
index do
column "Actions" do |payment|
links = []
links << link_to("View", admin_payment_path(payment))
links.join(" <br><br> ").html_safe
end
end
show do
attributes_table do
row :id
row :remote_id
row :credit_card_id
row :State
row :Refund_id
row :Created_at
row :updated_at
row :amount
row :currency
row :subscription_id
end
active_admin_comments
end
end
And I call this show action like that :
link_to("View", admin_payment_path(payment))
I have the following error thaht I can not understand :
ActionView::Template::Error (wrong number of arguments (1 for 0)):
1: insert_tag renderer_for(:show)
activerecord (4.0.3) lib/active_record/attribute_methods/read.rb:58:in `__temp__d6564786f646'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/view_helpers/display_helper.rb:30:in `display_name_method_for'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/view_helpers/display_helper.rb:18:in `display_name'
arbre (1.0.1) lib/arbre/element.rb:175:in `method_missing'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/show.rb:36:in `default_title'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/show.rb:14:in `title'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/base.rb:25:in `block in build_active_admin_head'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/base.rb:24:in `build_active_admin_head'
/ruby/bundler/gems/active_admin-9ca081f47ab4/lib/active_admin/views/pages/base.rb:9:in `build'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
/ruby/bundler/gems/active_admin-9ca081f47ab4/app/views/active_admin/resource/show.html.arb:1:in `block in __ruby_bundler_gems_active_admin__ca___f__ab__app_views_active_admin_resource_show_html_arb__2881818806947822812_77228080'
arbre (1.0.1) lib/arbre/context.rb:45:in `instance_eval'
arbre (1.0.1) lib/arbre/context.rb:45:in `initialize'
/ruby/bundler/gems/active_admin-9ca081f47ab4/app/views/active_admin/resource/show.html.arb:1:in `new'
/ruby/bundler/gems/active_admin-9ca081f47ab4/app/views/active_admin/resource/show.html.arb:1:in `__ruby_bundler_gems_active_admin__ca___f__ab__app_views_active_admin_resource_show_html_arb__2881818806947822812_77228080'
actionpack (4.0.3) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.3) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.3) lib/action_view/template.rb:141:in `render'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
actionpack (4.0.3) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.3) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.3) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.3) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.3) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.3) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.3) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.3) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.3) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.3) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
activesupport (4.0.3) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.3) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.0.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:233:in `default_render'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:161:in `to_html'
responders (1.0.0) lib/responders/flash_responder.rb:104:in `to_html'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:154:in `respond'
actionpack (4.0.3) lib/action_controller/metal/responder.rb:147:in `call'
actionpack (4.0.3) lib/action_controller/metal/mime_responds.rb:330:in `respond_with'
inherited_resources (1.4.1) lib/inherited_resources/actions.rb:13:in `show'
actionpack (4.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.3) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.3) lib/active_support/callbacks.rb:463:in `_run__1186283259363649751__process_action__callbacks'
activesupport (4.0.3) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.3) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.3) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.3) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.3) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.3) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.3) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.3) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.3) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.3) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.3) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.3) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.3) lib/action_dispatch/routing/route_set.rb:680:in `call'
omniauth (1.4.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.4.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.4.2) lib/omniauth/strategy.rb:186:in `call!'
omniauth (1.4.2) lib/omniauth/strategy.rb:164:in `call'
omniauth (1.4.2) lib/omniauth/builder.rb:63:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.5) lib/rack/etag.rb:23:in `call'
rack (1.5.5) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.5) lib/rack/head.rb:11:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.5) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.5) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.3) lib/active_record/query_cache.rb:36:in `call'
airbrake (9.0.2) lib/airbrake/rack/middleware.rb:33:in `call!'
airbrake (9.0.2) lib/airbrake/rack/middleware.rb:21:in `call'
activerecord (4.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.3) lib/active_support/callbacks.rb:373:in `_run__4337536015866295967__call__callbacks'
activesupport (4.0.3) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.5) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.5) lib/rack/lock.rb:17:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.5) lib/rack/sendfile.rb:112:in `call'
rack-cors (0.4.1) lib/rack/cors.rb:81:in `call'
railties (4.0.3) lib/rails/engine.rb:511:in `call'
railties (4.0.3) lib/rails/application.rb:97:in `call'
rack (1.5.5) lib/rack/content_length.rb:14:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `catch'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.5.5) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.5) lib/rack/server.rb:264:in `start'
railties (4.0.3) lib/rails/commands/server.rb:84:in `start'
railties (4.0.3) lib/rails/commands.rb:76:in `block in <top (required)>'
railties (4.0.3) lib/rails/commands.rb:71:in `tap'
railties (4.0.3) lib/rails/commands.rb:71:in `<top (required)>'
script/rails:6:in `require'
script/rails:6:in `<main>'
Rendered /ruby/gems/actionpack-4.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
Rendered /ruby/gems/actionpack-4.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.4ms)
Rendered /ruby/gems/actionpack-4.0.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (10.3ms)
Thank you for your help, I am a beginner in Ruby On Rails and ActiveAdmin
It looks like the block opened by attributes_table do isn't closed, so I'd start by adding an end after the last row line and seeing if the error changes or disappears.
Also, for what it's worth, based on ActiveAdmin's API documentation, I don't think the line actions :index, :show is necessary -- it specifically says that "all CRUD actions are enabled by default", so there shouldn't be a need to explicitly define those actions. I might try taking it out and seeing what happens.
The exception indicates ActiveAdmin is not finding a default title for the page, so try:
show title: 'Payment' do
...
end
or define a display_name() method on the Payment model.
The association method from simple_form is throwing an exception on the most basic use, and I cannot figure out why. I'd appreciate any help.
I have a has_and_belongs_to_many association between the Users and Projects models:
project.rb:
class Project < ActiveRecord::Base
has_and_belongs_to_many :users
belongs_to :owner, :class_name => "User", :foreign_key => "owner_id"
...
user.rb:
class User < ActiveRecord::Base
has_and_belongs_to_many :projects
has_many :projects_owned, :class_name => "Project", :foreign_key => "owner_id"
...
edit.html.erb:
<%= simple_form_for #project do |f| %>
<%= f.input :name, input_html: { size: 61 } %>
<%= f.input :description, as: :text, input_html: { cols: 60 } %>
<%= f.association(:users) %>
<%= f.submit "Save project", class: "btn btn-large btn-primary" %>
<% end %>
All models have corresponding tables, and the association works correclty in Rspec tests and the Rails console.
When I build the form, exactly as specified in the simple_form documentation, I get the following error:
<ArgumentError: wrong number of arguments (0 for 1)>
Stack trace:
ArgumentError - wrong number of arguments (0 for 1):
simple_form (3.0.1) lib/simple_form/inputs/collection_input.rb:87:in `collection_includes_basic_objects?'
simple_form (3.0.1) lib/simple_form/inputs/collection_input.rb:70:in `detect_common_display_methods'
simple_form (3.0.1) lib/simple_form/inputs/collection_input.rb:57:in `detect_collection_methods'
simple_form (3.0.1) lib/simple_form/inputs/collection_select_input.rb:5:in `input'
simple_form (3.0.1) lib/simple_form/wrappers/many.rb:29:in `block in render'
simple_form (3.0.1) lib/simple_form/wrappers/many.rb:27:in `render'
simple_form (3.0.1) lib/simple_form/wrappers/root.rb:15:in `render'
simple_form (3.0.1) lib/simple_form/form_builder.rb:120:in `input'
simple_form (3.0.1) lib/simple_form/form_builder.rb:212:in `association'
app/views/projects/edit.html.erb:12:in `block in _app_views_projects_edit_html_erb___630637963_32694600'
actionpack (4.0.4) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionpack (4.0.4) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
actionpack (4.0.4) lib/action_view/helpers/capture_helper.rb:38:in `capture'
actionpack (4.0.4) lib/action_view/helpers/form_helper.rb:435:in `form_for'
simple_form (3.0.1) lib/simple_form/action_view_extensions/form_helper.rb:22:in `block in simple_form_for'
simple_form (3.0.1) lib/simple_form/action_view_extensions/form_helper.rb:41:in `with_simple_form_field_error_proc'
simple_form (3.0.1) lib/simple_form/action_view_extensions/form_helper.rb:21:in `simple_form_for'
app/views/projects/edit.html.erb:9:in `_app_views_projects_edit_html_erb___630637963_32694600'
actionpack (4.0.4) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.4) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.4) lib/action_view/template.rb:141:in `render'
actionpack (4.0.4) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
actionpack (4.0.4) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.0.4) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.4) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.4) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (4.0.4) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
actionpack (4.0.4) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
actionpack (4.0.4) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.4) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.4) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.4) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.4) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.4) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.4) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.4) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.4) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.4) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.4) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (4.0.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.4) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.0.4) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.0.4) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.0.4) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.4) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.4) lib/active_support/callbacks.rb:413:in `_run__482912548__process_action__callbacks'
activesupport (4.0.4) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.4) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.4) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.4) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.4) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.0.4) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.4) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.4) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.4) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.4) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.4) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.4) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.4) lib/action_dispatch/routing/route_set.rb:674:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.4) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.4) lib/active_record/migration.rb:373:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.4) lib/active_support/callbacks.rb:373:in `_run__957210712__call__callbacks'
activesupport (4.0.4) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.0.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.0.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.4) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.4) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.4) lib/rails/engine.rb:511:in `call'
railties (4.0.4) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
The problem has something to do with the collection for the form field.
See if this works:
<%= f.association :users, collection: User.all %>
I haven't tracked down why the collection is needed yet, but that seems to be the problem.
I have created a rails app using
gem 'ckeditor'
gem 'carrierwave'
gem 'mini_magick'
Everything works fine. But when I try to upload an image in local server, it is not uploading and an error is created in rails server
NoMethodError (undefined method `size' for nil:NilClass):
mini_magick (3.7.0) lib/mini_magick.rb:24:in `choose_processor'
mini_magick (3.7.0) lib/mini_magick.rb:64:in `mogrify?'
mini_magick (3.7.0) lib/mini_magick/image.rb:360:in `run_command'
mini_magick (3.7.0) lib/mini_magick/image.rb:203:in `[]'
ckeditor (4.0.10) lib/ckeditor/backend/carrierwave.rb:57:in `read_dimensions'
carrierwave (0.9.0) lib/carrierwave/uploader/processing.rb:85:in `block in process!'
carrierwave (0.9.0) lib/carrierwave/uploader/processing.rb:81:in `each'
carrierwave (0.9.0) lib/carrierwave/uploader/processing.rb:81:in `process!'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:18:in `each'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'
carrierwave (0.9.0) lib/carrierwave/uploader/cache.rb:122:in `cache!'
carrierwave (0.9.0) lib/carrierwave/mount.rb:327:in `cache'
carrierwave (0.9.0) lib/carrierwave/mount.rb:179:in `data='
carrierwave (0.9.0) lib/carrierwave/orm/activerecord.rb:38:in `data='
ckeditor (4.0.10) app/controllers/ckeditor/application_controller.rb:13:in `respond_with_asset'
ckeditor (4.0.10) app/controllers/ckeditor/pictures_controller.rb:12:in `create'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.2) lib/active_support/callbacks.rb:433:in `_run__908729428__process_action__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
railties (4.0.2) lib/rails/engine.rb:511:in `call'
railties (4.0.2) lib/rails/railtie/configurable.rb:30:in `method_missing'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.2) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.2) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `_run__448849553__call__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.2) lib/rails/engine.rb:511:in `call'
railties (4.0.2) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/home/shivakumaarmgs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/home/shivakumaarmgs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/home/shivakumaarmgs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I have the following mini_magick and carrierwave gems installed
/home/shivakumaarmgs/.rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/mini_magick-3.7.0
/home/shivakumaarmgs/.rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/carrierwave-0.9.0
What is the problem? Someone help..!!
I have also faced the same issue.
The problem is solved after I installed imagemagick
sudo apt-get install imagemagick
I faced with the following problem:
I am using rails 4 with Postgresql. I use awesome feature called hstore for storing sets of key/value pairs in my db.
Record example:
<Category id: 2, name: "Phone",..., additional_fields: {"ram"=>"2gb", "camera"=>"8mp"}>
> Category.find(2).additional_fields.class
=> Hash
But inside my view (or even inside controller) this transforms to String!
<% #category.additional_fields.class %> # returns String
Controller:
def set_category
#category = Category.find(params[:id])
end
Because of this next piece of code causes an error
<% #category.additional_fields.each do |key, value| %>
<div class="form-group">
<%= text_field_tag key, key %>
...
<% end %>
undefined method `each' for "\"ram\"=>\"2gb\", \"camera\"=>\"8mp\"":String
Full trace:
app/views/categories/_form.html.erb:21:in `block (2 levels) in _app_views_categories__form_html_erb__671254231_94341970'
actionpack (4.0.0) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionpack (4.0.0) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
actionpack (4.0.0) lib/action_view/helpers/capture_helper.rb:38:in `capture'
actionpack (4.0.0) lib/action_view/helpers/form_helper.rb:699:in `fields_for'
actionpack (4.0.0) lib/action_view/helpers/form_helper.rb:1538:in `fields_for'
app/views/categories/_form.html.erb:20:in `block in _app_views_categories__form_html_erb__671254231_94341970'
actionpack (4.0.0) lib/action_view/helpers/capture_helper.rb:38:in `block in capture'
actionpack (4.0.0) lib/action_view/helpers/capture_helper.rb:200:in `with_output_buffer'
actionpack (4.0.0) lib/action_view/helpers/capture_helper.rb:38:in `capture'
actionpack (4.0.0) lib/action_view/helpers/form_helper.rb:435:in `form_for'
app/views/categories/_form.html.erb:1:in `_app_views_categories__form_html_erb__671254231_94341970'
actionpack (4.0.0) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.0) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.0) lib/action_view/template.rb:141:in `render'
actionpack (4.0.0) lib/action_view/renderer/partial_renderer.rb:306:in `render_partial'
actionpack (4.0.0) lib/action_view/renderer/partial_renderer.rb:279:in `block in render'
actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (4.0.0) lib/action_view/renderer/partial_renderer.rb:278:in `render'
actionpack (4.0.0) lib/action_view/renderer/renderer.rb:47:in `render_partial'
actionpack (4.0.0) lib/action_view/helpers/rendering_helper.rb:27:in `render'
app/views/categories/edit.html.erb:3:in `_app_views_categories_edit_html_erb___781726467_94347130'
actionpack (4.0.0) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.0) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.0) lib/action_view/template.rb:141:in `render'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:49:in `block (2 levels) in render_template'
actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:48:in `block in render_template'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:56:in `render_with_layout'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.0) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.0) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.0) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/mike/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:413:in `_run__967049018__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__795012590__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
thin (1.6.1) lib/thin/connection.rb:82:in `block in pre_process'
thin (1.6.1) lib/thin/connection.rb:80:in `catch'
thin (1.6.1) lib/thin/connection.rb:80:in `pre_process'
thin (1.6.1) lib/thin/connection.rb:55:in `process'
thin (1.6.1) lib/thin/connection.rb:41:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.6.1) lib/thin/backends/base.rb:73:in `start'
thin (1.6.1) lib/thin/server.rb:162:in `start'
rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
rack (1.5.2) lib/rack/server.rb:264:in `start'
railties (4.0.0) lib/rails/commands/server.rb:84:in `start'
railties (4.0.0) lib/rails/commands.rb:78:in `block in <top (required)>'
railties (4.0.0) lib/rails/commands.rb:73:in `tap'
railties (4.0.0) lib/rails/commands.rb:73:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
In my case
I have just rollback migration and again execute it and after this problem is solved
I'm using Rails 4 with Bootstrap 2.3.2 and have been noticing a seemingly random error that I can't figure out. I suspect it might have something to do with incompatibility between turbolinks and Twitter Bootstrap.
Can somebody help me identify the problem? Apologies for the lengthy post below but I wanted to provide as much info as possible. Thanks!
Here's the error:
Errno::EINVAL in StaticPages#home
Showing /app/views/layouts/application.html.erb where line #5 raised:
Invalid argument - /tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705
Here's the extracted code from /app/views/layouts/application.html.erb:
<html>
<head>
<title>Name</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
The problem is in the 4th line in the code above:
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
Here's the framework trace:
sprockets (2.10.0) lib/sprockets/cache/file_store.rb:27:in `initialize'
sprockets (2.10.0) lib/sprockets/cache/file_store.rb:27:in `open'
sprockets (2.10.0) lib/sprockets/cache/file_store.rb:27:in `open'
sprockets (2.10.0) lib/sprockets/cache/file_store.rb:27:in `[]='
sprockets (2.10.0) lib/sprockets/caching.rb:34:in `cache_set'
sprockets (2.10.0) lib/sprockets/caching.rb:92:in `cache_set_hash'
sprockets (2.10.0) lib/sprockets/caching.rb:68:in `cache_asset'
sprockets (2.10.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.10.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.10.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.10.0) lib/sprockets/environment.rb:75:in `find_asset'
sprockets (2.10.0) lib/sprockets/base.rb:295:in `[]'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:144:in `lookup_asset_for_path'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:113:in `block in stylesheet_link_tag'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:112:in `map'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:112:in `stylesheet_link_tag'
actionpack (4.0.0) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.0) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.0) lib/action_view/template.rb:141:in `render'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.0) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.0) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.0) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.0) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (4.0.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.0) lib/active_support/callbacks.rb:403:in `_run__203810741__process_action__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__76538721__call__callbacks'
activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'