Project

General

Profile

Add field to Issue

Added by demas demas almost 14 years ago

I need to add additional field to Issue which will work like the 'Assigned to' field. As I see I can not setup this field. I have found custom list field, but it have static list of values.

I have tried to develop it.

1. I have created migration:

class AddControllerToIssue < ActiveRecord::Migration
  def self.up
      add_column("issues", "controller_to_id", :integer)
  end

  def self.down
      remove_column("issues", "controller_to_id")
  end
end

2. I have added this line of code to Issue model:

  belongs_to :controller_to, :class_name => 'User', :foreign_key => 'controller_to_id'  

3. I have added field to view (views\issues\_attributes.rhtml):

  <p><%= f.select :controller_to_id, (@issue.assignable_users.collect {|m| [m.name, m.id]}), :include_blank => true %></p>

I have my field on New Issue form and I have the list of users on it, but value which users set on it doesn't save to database.
Why?

p.s. Sorry for my english and my rails knowledge :)


Replies (1)

RE: Add field to Issue - Added by demas demas almost 14 years ago

I have found the answer by myself.
[[http://www.redmine.org/plugins/redmine_qa_contact]] - QA Contact. I looks at plugin code and make similar one.

    (1-1/1)