Displaying 2 results from an estimated 2 matches for "industry_id".
2006 Jan 05
3
ActiveRecord setting IDs on auto increment fields
...It seems like ActiveRecord is setting the
"id" field for the join table- This should be an auto_increment and
ActiveRecord shouldn''t need to force a value, no?
the table looks like this:
CREATE TABLE `industries_risks` (
`id` int(10) unsigned NOT NULL auto_increment,
`industry_id` int(10) unsigned default NULL,
`risk_id` int(10) unsigned default NULL,
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
PRIMARY KEY (`id`)
) TYPE=InnoDB;
the code in question is almost directly ripped from this tutorial:
http://jrhicks.net/Projects/rails/has_m...
2009 Mar 23
2
Select updates database?
...provide more information if needed, but I would like the field
to work as a dropdown instead of a text field.
My Model:
has_and_belongs_to_many :industries, :join_table =>
"grant_loans_industry", :foreign_key =>
"grant_loans_id", :association_foreign_key => "industry_id"
belongs_to :state
My Controller:
before_filter :login_required
layout "admin"
active_scaffold :grant_loan do |config|
config.list.columns = [:agency, :gov_type, :title, :url]
config.columns.exclude :state_name
config.label = ''Grants and Loans'...