search for: tabledefinit

Displaying 11 results from an estimated 11 matches for "tabledefinit".

2008 Feb 26
5
Rails 2.0.2 MySQL 'year' datatype missing from ActiveRecord?
...9;' datatype missing from ActiveRecord in 2.0.2? According to my MySQL 5.0 reference manual, ''year'' is a datatype, but when I try to run a migration that has a t.year column, I get this: rake aborted! undefined method `year'' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x274a070> I opened up the mysql_adapter.rb file in my frozen 2.0.2 ActiveRecord, and sure enough, ''year'' was missing from the native_database_types hash, so I added it. rake db:migrate still doesn''t work (continues to give the same error, and I can''t find...
2006 Aug 02
2
mangle ActiveRecord
...(optionally) creates my created_at, deleted, key_id, session_id etc columns that I use on basically all tables. It would not be DRY to repeat this on all my migrations. I figured module ActiveRecord::ConnectionAdapters::SchemaStatements def create_table(name, options={}) table_definition = TableDefinition.new(self) table_definition.primary_key(options[:primary_key] || "id") unless options[:id] == false table_definition.column(:obj , :bigint ) unless options[:obj] == false table_definition.column(:session_id, :bigint ) unless options[:session] == false tab...
2006 Apr 19
6
undefined method `create_table'' for #<LoginController:0x5e60
...'' 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() yields a TableDefinition instance create_table(:suppliers) do |t| t.column :name, :string, :limit => 60 # Other fields here end end def authorize unless session[:user_id] flash[:notice] = "Please log in" redirect_to(:controller => "login", :action => "login") end end priva...
2009 Sep 28
5
Multi-databases support
Hi, While I was hacking ovirt-server, I have found that it's currently restricted to Postgres DB. Even if I like postgres for serious work on a server, I really prefer to hack/dev locally on a Sqlite or MySQL DB. I have googled on rails in order to find a good answer for the "foreign key problem" which forces OVirt to stay on pg. I have found a plugin on this particular
2006 Feb 26
1
Migrations: column option "offset"?
...column options are: - limit - offset - null (i.e. ? :null => false? implies NOT NULL) - default (to specify default values) I was wondering what the purpose of the "offset" option is. And after looking at the API at http://api.rubyonrails.com/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#M000569 I''m wondering whether this option exists at all? Is it an error on the wiki? Thanks, Mike. -- Posted via http://www.ruby-forum.com/.
2010 Aug 22
1
rails3: t.index in migrations not working anymore
...ing to upgrade one of my applications to Rails 3.0.0.rc and I get an error which should be still working. Migration: t.index :name When I execute rake: rake aborted! An error has occurred, all later migrations canceled: undefined method `index'' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x4b2b6b0> Does some one know what''s wrong here? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3Mboc...
2007 Sep 27
2
How specify size of string column in a migration
I am new to RoR. How do you specify the size of a string column in a migration? The examples I''ve see are all of the form: t.column :name, string which produces a VARCHAR(255). I want a VARCHAR(40). Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to
2010 Aug 08
0
registerable method undefined in Devise migration (was Re: Re: No route matches)
...==  DeviseCreateUsers: migrating > ============================================== > -- create_table(:users) > rake aborted! > An error has occurred, this and all later migrations canceled: > > undefined method `registerable'' for > #<ActiveRecord::ConnectionAdapters::TableDefinition:0x1b2c8c4> > > (See full trace by running task with --trace) > > Provided that "user.rb" and the migration files are as shown in the > attachment. > > Thanks. > > > Attachments: > http://www.ruby-forum.com/attachment/4928/Files.zip It sounds like th...
2012 Mar 02
2
Change DB data type and limited decimals
Rails3.1.3 I have db type, startp:integer I need to change it to float. More specifically, 1.2, 45.1, 143.8 ... I have two questions: 1. Is removing and adding the field through migration the only way? in other words, is there a single command to change the type? 2. Is there anyway to limit the decimal place to only one? 56.3, 34.2... are acceptable, but 23.112, 77.34, ... are
2006 Apr 30
4
Migration, BigInts, and string lengths
Howdy Y''all, I was thrilled to recently discover migrations, as that framework addresses a common problem in an elegant way. I have, however, gotten tripped up a bit as I''ve worked with them. The first problem I encountered was that, though I was using a BigInt data type in a field in my dev database, my unit tests were failing because when I copied the schema from the dev
2009 Aug 13
10
default value if textfield is empty
Hey all, im not sure where to set a default value if a textfield is empty? For now i do it in the controller, and check if the submitted parameter is blank. But this seems not to be the best solution... Thanks for your help! -- Posted via http://www.ruby-forum.com/.