I can''t seem to find this anywhere... How would I define the number in varchar(#) with the migration tool. By default when using :string it sets it at 255. Probably a really simple answer to this, thanks for the help. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
:limit => n On 08/09/06, salo <danielsalo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I can''t seem to find this anywhere... How would I define the number in > varchar(#) with the migration tool. By default when using :string it > sets it at 255. Probably a really simple answer to this, thanks for > the help. > > > > >-- Rasputin :: Jack of All Trades - Master of Nuns http://number9.hellooperator.net/ --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Take a look at :limit. add_column :your_table, :your_column, :string, :limit => 20 This page from the Rails API lists all the options. http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html#M000659 Aaron On 9/8/06, salo < danielsalo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I can''t seem to find this anywhere... How would I define the number in > varchar(#) with the migration tool. By default when using :string it > sets it at 255. Probably a really simple answer to this, thanks for > the help. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
> I can''t seem to find this anywhere... How would I define the number in > varchar(#) with the migration tool. By default when using :string it > sets it at 255. Probably a really simple answer to this, thanks for > the help.There''s a reason that it defaults to 255. Because for the vast majority of cases, it Just Doesn''t Matter. It''s not worth dedicating brain cycles to try to figure out what the optimal size of a field is. Especially not with varchar, which automatically contracts and expands any way. You''ll usually guess too low anyway and then later have to change it. David Heinemeier Hansson --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
thanks for the help and advice... -salo --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---