search for: create_t

Displaying 20 results from an estimated 419 matches for "create_t".

Did you mean: createvt
2006 Apr 19
6
undefined method `create_table'' for #<LoginController:0x5e60
I am geeting the foolowing error. undefined method `create_table'' for #<LoginController:0x5e60110> I wrote the crete action in application controller. I am coping ther total worng please help me! class ApplicationController < ActionController::Base model :cart model :line_item before_filter :authorize def create # create_table() yield...
2006 Jun 13
11
Question: Migration - multiple creates
...multiple tables, so i''m guessing the correct format would be: Can anyone confirm ? I''m guessing that each new create script requires a seperate class so formatted this way. Perhaps I''m wrong. TIA Stuart class CreateTable1 < ActiveRecord::Migration def self.up create_table :table1s do |t| t.column :length, :string end end def self.down drop_table :table1s end end class CreateTable2 < ActiveRecord::Migration def self.up create_table :table2s do |t| t.column :length, :string end end def self.down drop_table :table2s end end...
2006 Sep 05
0
rake craziness with Migrate as a dependency
.../ruby/bin/rake.bat Started Finished in 0.0 seconds. 0 tests, 0 assertions, 0 failures, 0 errors c:\dve\ideeli_trunk\lib\tasks>rake db:migrate --trace rake db:migrate --trace (in c:/dve/ideeli_trunk) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment -- create_table("rails_crons") -> 0.1010s -- add_column(:rails_crons, :concurrent, :boolean) -> 0.2100s ** Execute db:migrate == Init: migrating ============================================================ -- create_table("colors", {:force=>true}) -> 0.0800s -- add_inde...
2006 Aug 13
4
has_many and foreign_key question
...to have a ''has_many'' relationship, and I can''t seem to get override the rails assumptions for my tables. I have two tables, ''properties'' and ''jurisdiction_rates''. class CreateProperties < ActiveRecord::Migration def self.up create_table :properties do |t| t.column :address, :string t.column :jurisdiction_id, :string end end class CreateJurisdictionRates def self.up create_table :jurisdiction_rates do |t| t.column :jurisdiction_id, :string t.column :tax_rate, :string t.column :type, :strin...
2006 Apr 03
2
HABTM migrations
Bad rails day for Matt- In a migration, for a habtm: create_table :teams_users do |t| t.column :team_id, :integer t.column :user_id, :integer end Ok, fine. In a controller (well really a migration script): @user.teams << Team.find( 3 ) And the SQL pumped at my server is: INSERT INTO teams_users (`team_id`, `id`, `u...
2009 Apr 09
4
create_table with unique combo
I need to create a table replacing default integer id with a string id and making a combo of (id and version) unique primary key. Here is what I''ve got so far. class CreateCatalogs < ActiveRecord::Migration def self.up create_table :catalogs, :id => false do |t| t.string :id, :limit => 20, :null => false t.string :version, :default => ''01'' t.timestamps end end def self.down drop_table :catalogs end end --~--~---------~--~----~------------~-------~--~----~ Yo...
2006 Jun 05
5
adding habtm through migrations
...model Product and would like to add a new model called Category. Furthermore, I want to set up a many2many relationship between the mentioned models. the problem is that I do not know how to set the primary key in the categories_products table. this is what I''ve got in my migration file: create_table :categories do |t| t.column :name, :string # Other fields here end create_table :categories_products do |t| t.column :category_id, :integer t.column :product_id, :integer #how do I set the primary key to be (category_id, product_id) end Cheers Regards srdjan
2006 Mar 31
2
A.R. Associations problem
Hello, I''m learning A.R Associations by creating a simple forum that consists of 3 tables: ahuthors, topics and posts. This is the schema: class AddAuthorAndTopicAndPostTables < ActiveRecord::Migration def self.up create_table :authors do |t| t.column :username, :string t.column :email, :string t.column :created_on, :datetime end create_table :topics do |t| t.column :topic, :string t.column :author_id, :integer t.column :created_on, :datetime end create_table :pos...
2006 Jan 12
1
Best Forum? Was: Migration doesn''t seem to preserve create_table options in schema
...er this question? Is there any better source for information or another mailinglist to address this question to? Cheers, Mariano ---------- Forwarded message ---------- From: Mariano Kamp <mariano.kamp@gmail.com> Date: Jan 8, 2006 6:24 PM Subject: Migration doesn''t seem to preserve create_table options in schema To: rails@lists.rubyonrails.org Hi, I have the following migration (abbreviated): class Initial < ActiveRecord::Migration def self.up create_table :messages, :options => ''ENGINE=MyISAM'', :force => true do |t| t.column :id,...
2006 Apr 04
0
making a set column type with create_table
create_table(:username, :options => ''ENGINE=MyISAM DEFAULT CHARSET=utf8'') do |table| table.column :name, :string # THE LINE BELOW FAILS table.column :tag, :set ... ... end Hello all, I''d like to make a set column with the create_table method...
2006 Apr 12
0
create_table and char columns
When I use create_table to make a table :string always makes a varchar column. How can I make it so that :string will make a char column? create_table(:accounts, :options => ''ENGINE=MyISAM DEFAULT'') do |table| # This creates a varchar column, I would like a char column. table.column :usernam...
2006 Jan 08
0
Migration doesn''t seem to preserve create_table options in schema
Hi, I have the following migration (abbreviated): class Initial < ActiveRecord::Migration def self.up create_table :messages, :options => ''ENGINE=MyISAM'', :force => true do |t| t.column :id, :integer, :null => false t.column :external_id, :string, :null => false t.column :recipients_count, :integer, :default => 0 end end def sel...
2005 Dec 17
4
Rake migrate and creating join tables
...9;s a way to use migrations to generate join tables (where the table columns comprise only of foreign keys to other tables, and where the primary key is all the foreign keys taken together). I made the changes manually in MySQL, then did rake db_schema_dump and it gave something like this: create_table "apples_oranges", :id => false, :force => true do |t| t.column "apple_id", :integer, :limit => 10, :null => false t.column "orange_id", :integer, :limit => 10, :default => 0, :null => false end The problem is that when you run...
2010 Aug 18
6
Once I added this HABTM, one of my 'through' relationships, on a non-habtm model, seems to have broke?
...has_and_belongs_to_many :meters end class Meter < ActiveRecord::Base has_and_belongs_to_many :meter_groups belongs_to :user, :foreign_key => "user_id" end #Migrations (removed some cols and drop section) class CreateMeterGroups < ActiveRecord::Migration def self.up create_table :meter_groups do |t| t.string :name t.string :description t.integer :user_id t.timestamps end end end class CreateMeters < ActiveRecord::Migration def self.up create_table :meters do |t| t.integer :meter_type_id t.integer :scale_id t.in...
2006 Jun 23
1
Describing a "replaces" relationship within the same model
Hi! I would like to describe the relationships between two objects of a model, where one of the objects replaces the other. I want to be able to tell if one object has been replaced and, if so, by what object; and vice versa what object an object replaces, if any. My idea was the following: create_table :events do |t| t.column :replacement_id, :integer t.column :description, :text, :null => false end create_table :replacements, {:id => false} do |t| t.column :original_id, :integer, :null => false t.column :new_id, :integer, :null => false t.column :date, :date, :null =&g...
2008 Oct 26
3
Undefined method f_title
...ass CreateSampleForms < ActiveRecord::Migration def self.add_data SampleForm.create(:name => ''Default (Empty)'', :f_type => ''Default (Empty)'', :description => ''Use this template to create a blank form.'') end def self.up create_table :sample_forms do |t| t.string :name, :null => false t.string :f_title t.text :description t.timestamps end self.add_data end def self.down drop_table :sample_forms end end While migrating, it gives the error ''undefined method f_title=...
2006 Aug 04
3
Migration::alter statements ??
Hi, Where to put the execute statements in migration scripts? e.g, I would like to create a table and add a foreign_key reference. def self.up ?? execute "alter table ...." create_table :my_table do |t| t.column :user, :string end ?? execute "alter table ...." end Should the execute statement be above the table creation or below the table creation? Logically I would like to put it below the table creation. But sometimes the script is executed from the bot...
2008 Apr 18
3
has_many and belongs_to with non-primary foreign keys
Hi, I''m having a bit of trouble with my first Rails app. ---- I have two tables: create_table :items do |t| t.column :created_at, :timestamp t.column :user_id, :int t.column :text, :text end create_table :users do |t| t.column :user_id, :int t.column :name, :string end ---- I''m trying to use the "user_id" field to link both tables, with each user "has...
2010 May 25
2
Site Navigation With Polymorphic Has Many Through
...gt; :child_menu_items end class Page < ActiveRecord::Base has_one :parent_menu_item , :as => :parentable , :class_name => ''MenuItem'' has_one :parent , :through => :parent_menu_item end SCHEMA: ActiveRecord::Schema.define(:version => 20100525184637) do create_table "categories", :force => true do |t| t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end create_table "menu_items", :force => true do |t| t.integer "position", :null => false...
2007 Feb 06
3
Polymorphic either or but not both
I am trying to create a generic person model. Then subclass it as either a professor or an author. The only problem is that since some professors are authors, I don''t want duplicate entries. Any ideas on how to handle this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"