0

尝试编辑我使用refinerycms 创建的任何引擎中的任何数据时,我不断收到以下错误。什么会导致这种情况,我该如何解决?

错误

 NameError in Refinery/success_stories/admin/success_stories#edit

Showing /Users/tomcaflisch/Sites/PersonalTrainingKT/app/views/refinery/admin/_form_actions.html.erb where line #59 raised:

undefined local variable or method `delete_url' for #<#<Class:0x007fd0e6282f08>:0x007fd0e33d6fd8>

Extracted source (around line #59):

56:                 :id => cancel_button_id,
57:                 :class => "close_dialog button") unless hide_cancel %>
58: 
59:     <%= local_assigns[:after_cancel_button] -%>
60:   </div>
61:   <div class='form-actions-right'>
62:     <%= local_assigns[:before_delete_button] -%>

/refinery/success_stories/admin/success_stories/edit.html.erb

<%= render 'form' %>

/refinery/success_stories/admin/success_stories/_form.html.erb

<%= form_for [refinery, :success_stories_admin, @success_story] do |f| -%>
  <%= render '/refinery/admin/error_messages',
              :object => @success_story,
              :include_object_name => true %>


  <div class='field'>
    <%= f.label :name -%>
    <%= f.text_field :name, :class => 'larger widest'  -%>

  </div>

  <div class='field'>
    <%= f.label :goal -%>
    <%= f.text_field :goal -%>

  </div>


  <div class='field'>
    <%= f.label :occupation -%>
    <%= f.text_field :occupation  -%>

  </div>

  <div class='field'>
    <%= f.label :age -%>
    <%= f.text_field :age  -%>

  </div>

  <div class='field'>
    <%= f.label :beginning_weight -%>
    <%= f.text_field :beginning_weight  -%>

  </div>

  <div class='field'>
    <%= f.label :current_weight -%>
    <%= f.text_field :current_weight  -%>

  </div>

  <div class='field'>
    <%= f.label :gym -%>
    <%= f.text_field :gym  -%>

  </div>

  <div class='field'>
    <%= f.label :before_image -%>
    <%= render '/refinery/admin/image_picker',
               :f => f,
               :field => :before_image_id,
               :image => @success_story.before_image,
               :toggle_image_display => false %>

  </div>

  <div class='field'>
    <%= f.label :after_image -%>
    <%= render '/refinery/admin/image_picker',
               :f => f,
               :field => :after_image_id,
               :image => @success_story.after_image,
               :toggle_image_display => false %>

  </div>

  <div class='field'>
    <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
      <ul id='page_parts'>
        <% [:story].each_with_index do |part, part_index| %>
          <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
            <%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/success_stories/success_story", :default => part.to_s.titleize), "##{part}" %>
          </li>
        <% end %>
      </ul>
      <div id='page_part_editors'>
        <% [:story].each do |part| %>
          <div class='page_part' id='<%= part %>'>
            <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
          </div>
        <% end %>
      </div>
    </div>

  </div>

  <%= render '/refinery/admin/form_actions', :f => f,
             :continue_editing => false,
             :delete_title => t('delete', :scope => 'refinery.success_stories.admin.success_stories.success_story'),
             :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @success_story.name) %>
<% end -%>
<% content_for :javascripts do %>
  <script>
    $(document).ready(function(){
      page_options.init(false, '', '');
    });
  </script>
<% end %>
4

1 回答 1

2

在我看来,你已经覆盖了 app/views/refinery/admin/_form_actions.html.erb 并且你已经注释掉了第 33 行(在这个版本中是普通的):

delete_url          ||= eval("refinery.#{Refinery.route_for_model(f.object.class)}(#{f.object.id})")

如果您在开始时删除 # 注释,那么您会发现您的问题消失了 :-)

菲尔

于 2012-07-25T00:28:18.637 回答