开发者

ruby on rails - wrong number of arguments (0 for 1) when using 'form'

Showing app/views/frontend/get_months.html.erb where line #1 raised:

wr开发者_开发技巧ong number of arguments (0 for 1)
Extracted source (around line #1):

1: <%= render :partial => "months", :locals => {:form => form} %>
RAILS_ROOT: /rails_workcopy/er_spending_report

My get_month.html.erb has only one line of code. if i use <%= form.select(...) %>, the error still occurs... anyone can show me how to use render partial function? Thanks in advance!


According to http://api.rubyonrails.org/classes/ActionView/Partials.html your render partial syntax is correct.

If there's only one line in get_month.html.erb I would wonder from where you get the local variable "form" is coming from. Maybe it should be @form?

Also keep in mind that the partial you want to render needs to start with an underscore. So in your example you need a file _months.html.erb


Try (assuming you're passing the form through a block in form_for:

<%= render 'months', :f => form %>

Any luck?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜