Hello RoR veterans. When looking at the following line in in the RoR getting started guide: script/generate scaffold Post name:string title:string content:text My first thought was "Nice!! So they demo string and text. What are the differences between these two, and what other types are available?" So far I''ve seen the following used in various tutorials and blogs: string, text, integer, boolean, and references. I just wish there were an actual *reference* page for this. Like google made for the AppEngine API: http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html This (by the way) took me all of 60 seconds to find. I''ve been searching for a similar guide in RoR all day and haven''t found squat! --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Steve,> My first thought was "Nice!! So they demo string and text. What are > the differences between these two, and what other types are > available?"The types Active Record supports are :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean. (Source: http://guides.rails.info/migrations.html ) Also, on api.rubyonrails.org I found the following information pretty quickly: http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/TableDefinition.html Generally speaking, you usually find all you need in the Rails guides and the API documentation. Now I wish there was some usable way of finding answers to questions where you *don''t* know which part of Rails is doing the magic. I''d love to have some documentation based on the *topic*, like this here: http://www.php.net/manual/en/funcref.php Newbies (like myself!) also tend to be confused at times when trying to find out whether our question is a Ruby or a Rails question. Thankfully the Rails community is pretty friendly. :-) --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Awesome!! Thanks that helps a lot. One follow-up question, if I may: From what I''ve read, it seems that "references" are only to be used for "belongs_to" associations? Is it best practice to simply avoid using "references" and just manually use (for example): (Using script/generate) customer_id:integer (Or manually doing a migration file) t.customer_id :integer ??? I guess my question is: what is recommended best practice for using "references"? Thanks again for your help thortos! -Steve On Jan 27, 4:46 am, thortos <thor...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hi Steve, > > > My first thought was "Nice!! So they demo string and text. What are > > the differences between these two, and what other types are > > available?" > > The types Active Record supports > are :primary_key, :string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean. > > (Source:http://guides.rails.info/migrations.html) > > Also, on api.rubyonrails.org I found the following information pretty > quickly: > > http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Ta... > > Generally speaking, you usually find all you need in the Rails guides > and the API documentation. Now I wish there was some usable way of > finding answers to questions where you *don''t* know which part of > Rails is doing the magic. I''d love to have some documentation based on > the *topic*, like this here:http://www.php.net/manual/en/funcref.php > > Newbies (like myself!) also tend to be confused at times when trying > to find out whether our question is a Ruby or a Rails question. > Thankfully the Rails community is pretty friendly. :-)--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There is documentation on the different field types at http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html#M001780 ----- Ryan Bigg Mocra - Premier iPhone and Ruby on Rails Consultants w - http://mocra.com e - radar-+evGEzgkreAAvxtiuMwx3w@public.gmane.org p - +61 432 937 289 or +61 7 3102 3237 skype - radarlistener On 27/01/2009, at 7:04 PM, Steve H wrote:> > Hello RoR veterans. > > When looking at the following line in in the RoR getting started > guide: > > script/generate scaffold Post name:string title:string content:text > > My first thought was "Nice!! So they demo string and text. What are > the differences between these two, and what other types are > available?" > > So far I''ve seen the following used in various tutorials and blogs: > string, text, integer, boolean, and references. > > I just wish there were an actual *reference* page for this. Like > google made for the AppEngine API: > http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html > > This (by the way) took me all of 60 seconds to find. I''ve been > searching for a similar guide in RoR all day and haven''t found squat! > > >--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Ryan and thortos! I found a little more information that I was looking for here (as well as at your links): http://guides.rubyonrails.org/association_basics.html#_choosing_between_tt_belongs_to_tt_and_tt_has_one_tt Cheers! -Steve On Jan 27, 12:57 pm, Ryan Bigg <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> There is documentation on the different field types athttp://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Ta... > > ----- > Ryan Bigg > Mocra - Premier iPhone and Ruby on Rails Consultants > w -http://mocra.com > e - ra...-+evGEzgkreAAvxtiuMwx3w@public.gmane.org > p - +61 432 937 289 or +61 7 3102 3237 > skype - radarlistener > > On 27/01/2009, at 7:04 PM, Steve H wrote: > > > > > Hello RoR veterans. > > > When looking at the following line in in the RoR getting started > > guide: > > > script/generate scaffold Post name:string title:string content:text > > > My first thought was "Nice!! So they demo string and text. What are > > the differences between these two, and what other types are > > available?" > > > So far I''ve seen the following used in various tutorials and blogs: > > string, text, integer, boolean, and references. > > > I just wish there were an actual *reference* page for this. Like > > google made for the AppEngine API: > >http://code.google.com/appengine/docs/python/datastore/typesandproper... > > > This (by the way) took me all of 60 seconds to find. I''ve been > > searching for a similar guide in RoR all day and haven''t found squat!--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---