issue with calendar_date_select gem
my error, my usage was based on this link (form builder tab): http://electronicholas.com/calendar
ArgumentError in Sales#new
Showing app/views/sales/new.html.erb where line #14 raised:
wrong number of arguments (5 for 4)
Extracted source (around line #14):
11: <%= f.text_area :description %><br />
12: <br />
13: 开发者_JS百科<%= f.label :startdate %>:
14: <%= f.calendar_date_select :startdate, :embedded => true %><br />
15:
16:
17: <br />
Which version of CalendarDateSelect are you using? I have version 1.15. I found something similar in the bug tracker. Maybe you have an old version and if you update it will be fixed?
I have tried in my app using CalendarDateSelect in a form builder with embedding and it works.
<% form_for @project do |form| -%>
<%= form.calendar_date_select :starts_on, :embedded => true %>
<% end -%>
I get this on the page
<input id="project_starts_on" name="project[starts_on]" type="hidden" />
<span id="cds_placeholder_11065" style="display: none; position: absolute;"></span>
<script type="text/javascript">
//<![CDATA[
new CalendarDateSelect( $('cds_placeholder_11065').previous(), {embedded:true, year_range:10} );
//]]>
</script>
Make sure you put the includes at the top of your page/layout
<%= calendar_date_select_includes -%>
I suspect you should have used calendar_date_select_tag
there, instead of calendar_date_select
.
精彩评论