Forums » Development »
Multiple categories for issue creation
Added by poornima dhanasekaran about 11 years ago
Hi,
I've changed the select option as multiple select for accepting multiple categories for creating as single issue. Changed the category_id as string from int and modified the code as <%= f.select :category_id, (@project.issue_categories.collect {|c| [c.name, c.id]}), {:include_blank => true}, {:multiple => true, :style => "width:350px;",:size => 4 }%>.
In issues_controller,
category_ids = []
if params[:issue][:category_id].length > 1
params[:issue][:category_id].each do|category|
category_ids << category
end
else
category_ids = params[:issue][:category_id]
end
The values stored in db as,
category_id | --- - "69" - "72" |
select category_id from issues where id= 18824;
-------------------
I don't know why it stored like this. Can anyone help me out?.