Can someone tell me what I'm doing wrong here? I'm using the same page to do my Create and Update form have this code right at the top of my page:
This works:
<% if @media.blank? %>
&开发者_如何学Pythonlt;%= form_for(:media, :url => {:action => 'create'}) do |f| %>
<% end %>
This doesn't:
<% if @media.blank? %>
<%= form_for(:media, :url => {:action => 'create'}) do |f| %>
<% else %>
<%= form_for(:media, :url => {:action => 'update', :id => @media.id}) do |f| %>
<% end %>
The latter gives me this result: syntax error, unexpected keyword_else, expecting keyword_end'); else
Should I be doing my create & update in a different way?
Thanks.
<% if @media.blank? %>
<%= form_for(:media, :url => {:action => 'create'}) do |f| %>
<% end %>
<% else %>
<%= form_for(:media, :url => {:action => 'update', :id => @media.id}) do |f| %>
<% end %>
<% end %>
精彩评论