我有这样的表格:
<fieldset data-model="idea-art" class="idea-edit">
<h2>Artwork Specs</h2>
<%= form_for @idea do |f| %>
<div data-attribute="art_status" class="edit-field">
<%= f.label :art_status, "Art Status" %>
<%= f.select :art_status, Idea::ART_STATUSES %>
</div>
<div data-attribute="artist" class="edit-field">
<%= f.label :artist_id, "Artist" %>
<%= f.select :artist_id, User.artists.collect{|x|[x.full_name, x.id]}, :include_blank =>
true %>
</div>
<div data-attribute="default_size" class="edit-field">
<%= f.label :default_artwork_id, "Default Artwork" %>
<%= f.select :default_artwork_id, @idea.artworks.collect{|x|[x.dimensions, x.id]},
:include_blank => true %>
</div>
<div data-attribute="colors_offered" class="edit-field">
<%= f.label :colors, 'Colors Offered' %>
<%= f.collection_select :color_ids, Color.master_colors.order(:name), :id, :name, {},
{multiple: true}%>
</div>
<div data-attribute="base" class="edit-field">
<%= f.label :base, "Base" %>
<%= f.check_box :base %>
</div>
<div data-attribute="special_instructions" class="edit-field">
<%= f.label :special_instructions, "Special Instructions" %>
<%= f.text_area :special_instructions %>
</div>
<div data-attribute="artwork" class="edit-field">
<%= f.fields_for :artworks do |artworks_f| %>
<%= render 'artwork_fields', f: artworks_f %>
<% end %>
<p>
<%= link_to_add_fields "Click To Add Artwork", f, :artworks %>
</p>
</div>
<%= f.submit %>
<%end%>
</fieldset>
当我点击提交时,我的更改未更新。我尝试过很多东西,似乎没什么用。我是ruby的新手并且已经阅读了RailsGuide以形成帮助者,我仍然无法理解它。
我有什么遗失的吗?
由于
答案 0 :(得分:0)
您是否在Rails服务器日志中看到了请求?如果是这样,请在日志中查找回滚,这可能表示您的模型无效,可能是由于强参数设置。如果请求没有到达服务器,检查页面上的javascript错误,然后确保你没有使用(或打算使用)ajax请求,在这种情况下你可能需要在application.js中需要jquery_ujs在布局中使用csrf_meta_tag。