form_for argument error, only on new action in refinery extension

瀏覽次數:26 次
跳到第一則未讀訊息

Serena

未讀,
2015年5月28日 晚上11:26:592015/5/28
收件者:refine...@googlegroups.com
Hi,

I have created a custom events extension in my refinery application, and after a bundle update I can no longer create new events as I get an Argument Error (1 for 0). I can edit previously created events in my database, which show the exact same form, without any errors. 

I don't know where the argument error is, or the method causing the problem. My route looks like http://localhost:3000/refinery/events/new, and I don't even have a new method in my admin events controller and not sure where to look in the underlying refinerycms code for this default method. The line it is complaining about, I assume can only be seen in a generated file _vendor_extensions_events_app_views_refinery_events_admin_events__form_html_erb__1994445619011118025_49099980, but I don't know where to look for that either. 

If someone could give me tips on how to find the actual code it is complaining about that would be great!! Running refinery 2.1.3 and rails 3.2.17, ruby 1.9.3

Here is the stack trace and error:
wrong number of arguments(1 for 0)

Extracted source (around line #9):

6:   <div class='field'>
7:     <%= f.label :title -%>
8:     <%= f.text_field :title, :class => 'larger widest' -%>
9:   </div>
10: 
11:   <div class='field'>
12:     <%= f.label :startdate -%>

vendor/extensions/events/app/views/refinery/events/admin/events/_form.html.erb:9:in `to_s'
vendor/extensions/events/app/views/refinery/events/admin/events/_form.html.erb:9:in `block in _vendor_extensions_events_app_views_refinery_events_admin_events__form_html_erb__1994445619011118025_49099980'
actionpack (3.2.17) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.2.17) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
actionpack (3.2.17) lib/action_view/helpers/capture_helper.rb:40:in `capture'
actionpack (3.2.17) lib/action_view/helpers/form_helper.rb:378:in `form_for'
vendor/extensions/events/app/views/refinery/events/admin/events/_form.html.erb:1:in `_vendor_extensions_events_app_views_refinery_events_admin_events__form_html_erb__1994445619011118025_49099980'
actionpack (3.2.17) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.17) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.17) lib/action_view/template.rb:143:in `render'
actionpack (3.2.17) lib/action_view/renderer/partial_renderer.rb:265:in `render_partial'
actionpack (3.2.17) lib/action_view/renderer/partial_renderer.rb:238:in `block in render'
actionpack (3.2.17) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.17) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.17) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.17) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.17) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.17) lib/action_view/renderer/partial_renderer.rb:237:in `render'
actionpack (3.2.17) lib/action_view/renderer/renderer.rb:41:in `render_partial'
actionpack (3.2.17) lib/action_view/helpers/rendering_helper.rb:27:in `render'
vendor/extensions/events/app/views/refinery/events/admin/events/new.html.erb:1:in `_vendor_extensions_events_app_views_refinery_events_admin_events_new_html_erb___1157895856263429772_49102860'
actionpack (3.2.17) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.17) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.17) lib/action_view/template.rb:143:in `render'
actionpack (3.2.17) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.17) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.17) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.17) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
etc..

Thanks Serena

Philip Arndt

未讀,
2015年5月28日 晚上11:29:462015/5/28
收件者:refine...@googlegroups.com
Can you please show us the code for the entire form? You can put it in a https://gist.github.com if you'd like.

Serena

未讀,
2015年5月28日 晚上11:54:472015/5/28
收件者:refine...@googlegroups.com
Sure, here is _form.html.erb
It reports the problem as being on line 9, and there is no 'to_s' near this line?
vendor/extensions/events/app/views/refinery/events/admin/events/_form.html.erb:9:in `to_s'


<%= form_for [refinery, :events_admin, @event] do |f| -%>
  <%= render '/refinery/admin/error_messages',
              :object => @event,
              :include_object_name => true %>

  <div class='field'>
    <%= f.label :title -%>
    <%= f.text_field :title, :class => 'larger widest' -%>
  </div>

  <div class='field'>
    <%= f.label :startdate -%>
    <%= f.text_field :startdate, class: 'fdatepicker', :value => f.object.startdate.to_s(:default) -%>
  </div>

  <div class='field'>
    <%= f.label :enddate -%>
    <%= f.text_field :enddate, class: 'fdatepicker', :value => f.object.enddate.to_s(:default) -%>
  </div>

  <div class='field'>
    <%= f.label :colour -%>
    <%= f.text_field :colour -%>
  </div>

  <%= render '/refinery/admin/form_actions', :f => f,
             :continue_editing => false,
             :delete_title => t('delete', :scope => 'refinery.events.admin.events.event'),
             :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) -%>
<% end -%>

Philip Arndt

未讀,
2015年5月29日 凌晨12:07:372015/5/29
收件者:refine...@googlegroups.com
Yeah, errors like this are strangely reported and it's often not the right line number.

What version of Refinery was this running perfectly on before you bundle updated?

Serena Lien

未讀,
2015年5月29日 凌晨12:13:012015/5/29
收件者:refine...@googlegroups.com

Oh OK, it's a problem with the startdate.to_s(:default) which works when editing an existing date but not for the new action.

So just incorrect line error reporting. And I thought it got broken after bundle update but I must have changed it to display dates in my specified format (defined :default in date_format.rb) and not realised I broke it for new events.

Thanks for helping me realise my error!!

--
You received this message because you are subscribed to the "Refinery CMS" Google Group.
To post to this group, send email to refine...@googlegroups.com
 
http://www.refinerycms.com
---
You received this message because you are subscribed to a topic in the Google Groups "Refinery CMS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/refinery-cms/UmeiyOt_Dfw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to refinery-cms...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/refinery-cms/5963720c-8a24-4f86-9612-fcb539774e6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philip Arndt

未讀,
2015年5月29日 凌晨12:26:422015/5/29
收件者:refine...@googlegroups.com
No problem, sometimes all you need to do is explain it.. glad you got it sorted!
回覆所有人
回覆作者
轉寄
0 則新訊息