> Because you write that inside the ApplicationHelper module, this is
> creating a new ApplicationHelper::Array class with those 2 methods. In
> you test.rb it's not nested in a module. If you wrote your array
> extensions outside of the module you shouldn't have this problem.
> (Personally I would put extensions to core classes in files in lib/
> and require them from initializers rather than dumping them in
> ApplicationHelper. I would also be wary of adding too many quite
> specialized methods to Array.


Fred - I agree with the points you make about having a separate file in
lib and being careful about adding too many specialized functions to
core classes like Array. However I am not very clear on why adding a
method to Array class inside ApplicationHelper module creates a new
ApplicationHelper::Array class as opposed to opening the existing core
Array class and adding the to_h method to it. As I understood it, you
could open a class anywhere and add methods to it. Sounds like there are
caveats to this that I am not very clear on - would appreciate your help
in clarifying that.

Thanks,
-S
-- 
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to