As per Rails doc
( http://guides.rubyonrails.org/plugins.html#extending-core-classes )
my app being yoodle
I added in yoodle/lib
yoodle.rb
require "yoodle/core_ext"
module Yoodle
end
in yoodle/lib/my_app/core_ext
String.class_eval do
def to_squawk
"squawk! #{self}".strip
end
end
and I have added in yoodle/config/application.rb
config.autoload_paths += Dir["#{config.root}/lib",
"#{config.root}/lib/**/"]
but running in console
> "AAA".to_squawk raises an error
NoMethodError: undefined method `to_squawk' for "AAA":String
Is there anything else not mentionned in the Rails doc ?
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/FFN6nkjcy_wJ.
For more options, visit https://groups.google.com/groups/opt_out.