Forums » Development »
new method error : can't convert Symbol into String error
Added by macus leung about 13 years ago
I am writing a redmine plugin to do some data processing. I get the following errors when adding new record. How can I solve the issue ? Thanks
Error:
ActionView::Template::Error (can't convert Symbol into String):
1: <%= f.label :name, l(:field_name) %>
2: <%= f.text_field :name %>
3:
4: <%= f.label :fullname, l(:field_fullname) %>
lib/redmine/views/labelled_form_builder.rb:39:in `delete'
lib/redmine/views/labelled_form_builder.rb:39:in `label_for_field'
lib/redmine/views/labelled_form_builder.rb:31:in `label'
app/helpers/application_helper.rb:950:in `labelled_form_for'
Controller:
class ParticipantsController < ApplicationController
...
def new
@participant = Participant.new
end
def create
@participant = Participant.new(params[:participant])
if @participant.save
flash[:notice] = l(:notice_new_participant_was_created)
redirect_to :action => :index, :project_id => @project
else
render :action => :new
end
end
new.html.erb
<% html_title l(:label_participant_title) -%>
<div class="contextual">
<%= link_to(l(:label_back_to_index), {:controller => 'participants', :action => 'index', :project_id => @project}) %>
</div>
<h2><%= l(:label_new_participant_title) %></h2>
<%= labelled_form_for @participant, :url => participants_path(@project) do |f| %>
<%= error_messages_for 'participant' %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= f.submit l(:button_create) %>
<% end %>
_form.html.erb
<%= f.label :name, l(:field_name) %> <%= f.text_field :name %> <%= f.label :fullname, l(:field_fullname) %> <%= f.text_field :fullname %>