kubitron / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
78 stars 15 forks source link

error_messages_for problem #50

Closed DejaAugustine closed 12 years ago

DejaAugustine commented 12 years ago

My setup:

Redmine 1.4-stable Ubuntu 11.10 Ruby 1.9.2 (via RVM) Gem 1.8.24 Rails 2.3.14

I've encountered the following error while trying to use this plugin:

ActionView::TemplateError (undefined method `errors' for :gitolite_public_key:Symbol) on line #7 of vendor/plugins/redmine_git_hosting/app/views/my/account.html.erb:
4: </div>
5: <h2><%=l(:label_my_account)%></h2>
6: <%= error_messages_for 'user' %>
7: <%= error_messages_for :gitolite_public_key %>
8: 
9: <div class="splitcontentleft">
10:     <% labelled_form_for :user, @user, :url => { :action => "account" }, :html => { :id => 'my_account_form' } do |f| %>

Changing line 7 to the following seems to have done the trick, however:

<% if @gitolite_public_key.errors.any? %>
<ul>
<% @gitolite_public_key.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>

I'm not sure if this is the best way to solve it, but it's the recommended change for Rails 3 and oddly seems to have done the trick here.

kubitron commented 12 years ago

If you would look at the README, this plugin IS NOT compatible with Redmine 1.4.

There are a number of other problems with 1.4 which still need to be addressed.

mback2k commented 12 years ago

An alternative way to fix this would be to replace the following:

<%= error_messages_for :gitosis_public_key %>

with the following:

<%= error_messages_for @gitosis_public_key %>

Since that's an easy fix, it would be great if someone could push it. Thanks!