There has to be a simple explanation for this. I can do this to get the table name behind a model>> User.table_name=> "users" Great. But looking at the table_name code in active_record/base.rb, the table_name method is not static (no self.)! def table_name reset_table_name end So why can I call table_name as a static method ??? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> There has to be a simple explanation for this. > > I can do this to get the table name behind a model > >>> User.table_name > => "users" > > Great. But looking at the table_name code in active_record/base.rb, > the table_name method is not static (no self.)! > > def table_name > reset_table_name > end > > So why can I call table_name as a static method ???Scroll up to around line 353 and you''ll see this line: class << self # Class methods So if you remove everything else you really have this: module ActiveRecord class Base class << self # Class methods def table_name .... end end end end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---