-1

I would like to modify default method for rendering form (produced automatically using scaffold) so that it would fill certain field with a predefined value passed in a parameter.

I imagine the view line responsible for form rendering could look like this

<% render 'form' arg %>

Then I would like to be able to access arg in _from.html.erb so that I could insert it in one of the fields.

4

1 回答 1

2
<% render 'form', :arg => @arg %>

然后在您的部分中,您可以访问 value arg

向下滚动到Layouts and Rendering Guide中的“3.4.4 传递局部变量” 。

于 2013-05-25T23:03:42.307 回答