Ok this is happened to me a couple of times now and can't seem to figure out how or why. This goes back to my issue of creating tables based off of an item that is created. First I have this code: ActiveRecord::Schema.define do create_table(itemtablename, :options => 'ENGINE=InnoDB DEFAULT CHARSET=utf8') do |t| t.column :field_type, :string, :null => false t.column :item_text, :text, :null => false t.column :required, :tinyint, :null => false, :default => '0' t.column :image, :text, :null => true end end now I tried to use this statement in both my controller and my model: ActiveRecord::ConnectionAdapters::SchemaStatements.create_table( but I would get a undefined method `create_table' for ActiveRecord::ConnectionAdapters::SchemaStatements:Module error. I am having the same issue with running the ActiveRecord::ConnectionAdapters::DatabaseStatements.execute( command. I am trying to add data to the table that i created and the only way I can tell how to do that is by doing everything manual as the table names are going to be changing based on what item the user is creating or editing. I am connecting to a MySQL 5 db which as of right now is what we plan to run in production and I did install the mysql adapter (at least I think I did as it told me I successfully installed it.) How do I reference a different module? sorry for the dumb question but this is really starting to get on my nerves. I feel like I am so close yet so far away. Andrew
on 2005-11-18 19:53
on 2005-11-18 20:08
why not just use one table to hold ALL items? then you don't have to worry about all this dynamic table creation stuff.
on 2005-11-19 00:22
Yeah, after rethinking the design of the database and the app this is the route I am going to go. Andrew
on 2005-11-19 17:52
This is more a question for the more experienced among us: Are there any situations when dynamic table creation is a preferred technique? I have a sneaking suspicion that anything that can be done by dynamically creating tables can be replicated with a static structure, but is it ever better not to? -- Alex