I have two tables am_bas and am_applications on oracle database.
I created them thru following migrate scripts
class CreateAmBas < ActiveRecord::Migration
def self.up
create_table :am_bas do |t|
t.column :business_area, :string
t.column :created_on, :datetime
t.column :created_at, :datetime
t.column :updated_on, :datetime
t.column :updated_at, :datetime
t.column :lock_version, :integer
end
create_table(“am_applications_am_bas”, :id=>false) do |t|
t.column “am_application_id”, :integer
t.column “am_ba_id”, :integer
end
end
def self.down
drop_table :am_bas
end
end
and
class CreateAmApplications < ActiveRecord::Migration
def self.up
create_table :am_applications do |t|
t.column :business_application_name, :string
t.column :created_on, :datetime
t.column :created_at, :datetime
t.column :updated_on, :datetime
t.column :updated_at, :datetime
t.column :lock_version, :integer
end
end
def self.down
drop_table :am_applications
end
end
My controller is
def new
@am_application = AmApplication.new
@all_bas = AmBa.find(:all, :order=>“business_area”)
@selected = []
end
def create
@am_application = AmApplication.new(params[:am_application])
if @am_application.save
flash[:notice] = ‘AmApplication was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
I do get a view on web which includes all the am_bas rows in drop down
box, but when I create a new record the join table
am_applications_am_bas is empty.
What gives? Am breaking my head over it for last 3 hours. Any help
please