我可以在显示页面使用nested_form_for吗
<%= @movie.link_to_add "Add Trailers", :trailers %>
<%= @movie.fields_for :trailers do |trailer| %>
<%= trailer.text_field :name, :placeholder =>"enter the keyword " %>
<%= trailer.link_to_remove "Remove" %>
<% end %>'
我正在使用 imdb-party gem 从 imdb 数据库中获取记录。 现在我需要向电影添加预告片。我正在使用简单的nested_form_for 我想向数据库添加多个预告片。 所以基本上我想在我的节目电影页面上有一个链接,上面写着“添加预告片”,一旦我点击这个链接,就会出现一个带有 text_field 的嵌套表单,我想在其中添加 url 并提交。
请帮助..!我是 Rails 新手,
这是我正在尝试做的事情,这是写在显示页面上的。而不是写在表格上的,
这会给我返回一个错误 # 的未定义方法“link_to_add”
<%= @movie.link_to_add "Add Trailers", :trailers %>
<%= @movie.fields_for :trailers do |trailer| %>
<%= trailer.text_field :name, :placeholder =>"enter the keyword " %>
<%= trailer.link_to_remove "Remove" %>
<% end %>'
i am using imdb-party gem to fetch the records from imdb database .
now i need to add trailers to the movies. for which i am using simple nested_form_for
i want to add multiple trailers to the database .
so basically i want a link on my show movie page saying "Add Trailers", once i click on this a nested form should appear with a text_field , in which i want to add the url and submit .
plss help ..! i am newbie on rails
this is something i am trying to do , this is written on the show page ..not on the form
this returns me an error
undefined method `link_to_add' for #
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论