Simple question. I see the method "column.human_name" used in the scaffold and other places, but cannot seem to find any reference to it in the rails or ruby api docs. I understand what it does but can someone fill me in on where it is defined. Thanks. --Ryan
Ryan Wood wrote:>Simple question. I see the method "column.human_name" used in the >scaffold and other places, but cannot seem to find any reference to it >in the rails or ruby api docs. I understand what it does but can >someone fill me in on where it is defined. Thanks. > >I think it''s defined as a method of the Inflector class: def humanize(lower_case_and_underscored_word) lower_case_and_underscored_word.to_s.gsub(/_id$/, "").gsub(/_/, " ").capitalize end Hope this helps Kev
On 8/7/05, Ryan Wood <ryan.wood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Simple question. I see the method "column.human_name" used in the > scaffold and other places, but cannot seem to find any reference to it > in the rails or ruby api docs. I understand what it does but can > someone fill me in on where it is defined. Thanks.active_record/connection_adapters/abstract_adapter.rb (dev.rubyonrails.org/file/trunk/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb), where else? Seriously though, it helps to checkout the svn repository, load it up in your IDE, and do a "find in project" for "def human_name." There is a lot of code that''s either in private/protected methods, or in classes that aren''t documented with RDoc (like ActiveRecord::ConnectionAdapters::Column that defines human_name). I feel like I''m fairly comfortable in rails, but I still have to look all this stuff up. -- rick techno-weenie.net
> active_record/connection_adapters/abstract_adapter.rb > (dev.rubyonrails.org/file/trunk/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb), > where else? > > Seriously though, it helps to checkout the svn repository, load it up > in your IDE, and do a "find in project" for "def human_name." There > is a lot of code that''s either in private/protected methods, or in > classes that aren''t documented with RDoc (like > ActiveRecord::ConnectionAdapters::Column that defines human_name). I > feel like I''m fairly comfortable in rails, but I still have to look > all this stuff up.Just so long as you bear in mind, the reason it''s not documented is that it''s not supported. private / implementation methods aren''t guranteed to be stable between releases, so use them with care.> -- > rick > techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
> Just so long as you bear in mind, the reason it''s not documented is > that it''s not supported. private / implementation methods aren''t > guranteed to be stable between releases, so use them with care.I figured as much. I find it odd that something like that is even used in scaffolding. Scaffolding is probably the earliest code a young, bright eyed rails developer may encounter. -- rick techno-weenie.net