hi,
i am tring to stroe the two tables in a single table. but i store in
different 2 row in a table. actually i am new to ruby . so i don’t know
what to do? please any one help me asap.
controller table:
class AjaxtestController < ApplicationController
def test
@panels = Panel.find(:all, :order => ‘name’);
@demographic_categories = Demographic_category.find(:all, :order =>
‘name’);
if request.get?
@panel_question = Panel_question.new
else
@panel_question = Panel_question.new(params[:panel])
@panel_demo = Panel_question.new(params[:demographic_category])
if @panel_question.save and @panel_demo.save
flash[:notice] = "saved"
#redirect_to(:controller => "ajaxtest", :action => "test")
end
end
end
end
test.rhtml file
.multipleSelectBoxControl span{ /* Labels above select boxes*/
font-family:arial;
font-size:11px;
font-weight:bold;
}
.multipleSelectBoxControl div select{ /* Select box layout /
font-family:arial;
height:100%;
}
.multipleSelectBoxControl input{ / Small butons */
width:25px;
}
.multipleSelectBoxControl div{
float:left;
}
.multipleSelectBoxDiv
<%= collection_select(‘demographic_category’, ‘demographic_category_id’,
@demographic_categories, :id, :name, {},
{:multiple => ‘multiple’}) %>
<% end_form_tag %>
my database tables are:
panels - id, name
demographic_categories - id, name
panel_questions - id,panel_id,demographic_id
actally when i click panel combo box and moved another list box(it
contains 2 or 3 & more also). so i want to add panelid is 1 means and
list box is 2,1, 3 means , it should be stoer in database like
id panel_id demographic_id
1 1 2
2 1 1
3 1 3
Like this. please can anyone correct my code.