我剛剛在ubunutu/nginx/postgres上安裝了redmine,創建新項目時出現此錯誤...任何想法? (我是新來的紅寶石因此不能真正告訴它要發生)創建新項目時redmine或ruby 500內部錯誤:undefined local variable
Started GET "/projects/new" for 50.116.19.7 at Tue Aug 14 08:31:52 +0200 2012
Processing by ProjectsController#new as HTML
Rendered projects/_form.html.erb (4.2ms)
Rendered projects/new.html.erb within layouts/base (6.0ms)
Completed 500 Internal Server Error in 131ms
ActionView::Template::Error (undefined local variable or method `self_and_descendants' for #<Project:0xb490ca54>):
4: <!--[form:project]-->
5: <p><%= f.text_field :name, :required => true, :size => 60 %></p>
6:
7: <% unless @project.allowed_parents.compact.empty? %>
8: <p><%= label(:project, :parent_id, l(:field_parent)) %><%= parent_project_select_tag(@project) %></p>
9: <% end %>
10:
app/models/project.rb:333:in 'allowed_parents'
app/views/projects/_form.html.erb:7:in
'_app_views_projects__form_html_erb___577557764__627958918'
app/views/projects/new.html.erb:4:in '_app_views_projects_new_html_erb___126828522__630632748'
app/helpers/application_helper.rb:950:in `labelled_form_for'
app/views/projects/new.html.erb:3:in '_app_views_projects_new_html_erb___126828522__630632748'
從管理平臺/應用/模型/ project.rb(對不起,不能似乎想出如何屬性格式格式代碼在這裏顯示)
# Returns an array of projects the project can be moved to
# by the current user
def allowed_parents
return @allowed_parents if @allowed_parents
@allowed_parents = Project.find(:all, :conditions => Project.allowed_to_condition(User.current, :add_subprojects))
@allowed_parents = @allowed_parents - self_and_descendants
if User.current.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?)
@allowed_parents << nil
end
unless parent.nil? || @allowed_parents.empty? || @allowed_parents.include?(parent)
@allowed_parents << parent
end
@allowed_parents
end
# Sets the parent of the project with authorization check
def set_allowed_parent!(p)
unless p.nil? || p.is_a?(Project)
if p.to_s.blank?
p = nil
else
p = Project.find_by_id(p)
return false unless p
end
end
if p.nil?
if !new_record? && allowed_parents.empty?
return false
end
elsif !allowed_parents.include?(p)
return false
334,5 35%
elsif !allowed_parents.include?(p)
return false
end
set_parent!(p)
end
的錯誤是在項目模型'應用程序/模型/ project.rb:333:在「allowed_parents'' 你可以請粘貼項目模型這裏? – 2012-08-14 10:47:48
謝謝!!!因爲這裏沒有太多允許的字符,所以不要粘貼上面的代碼片段。 – petergus 2012-08-14 11:46:09