I'm a rails noob.
That said, I've been doing not too bad but am stumbling over a basic problem, probably a naming issue. Here's the steup:
class GeneralModType < ActiveRecord::Base has_and_belongs_to_many :GeneralMods
end
class GeneralMod < ActiveRecord::Base belongs_to :GeneralModType end
class CreateGeneralMods < ActiveRecord::Migration def self.up create_table :general_mods do |t| t.string :name
t.integer :general_mod_type_id, :rangebonus, :damagebonus, :srdamagebonus, :reloadbonus, :accbonus
t.timestamps end end
def self.down drop_table :general_mods end end
Now, from all the research I am frantically doing, this seems like it should work, but it doesn't. I go into the console, find the first GeneralMod, then do:
mod.GeneralModType = GeneralModType.new
mod.GeneralaModType.name = "blah"
mod.save
I get a saved mod type, but general_mod_type_id is still nil. I've got another relationship in another two classes that's working fine, so I'm guessing I'm just screwing up something basic here. This is a little higher level than I am used to, being a PHP schlub.
Any help?