On Thu, Nov 6, 2008 at 4:47 PM, Phillip Koebbe
<[EMAIL PROTECTED]> wrote:
> The Neurochild wrote:
>> So I put both methods on one files and load them in the environment?
>> That's it.
>
> Right. Here's the skinny on how I do it:
>
> I have a file
>
> {RAILS_ROOT}/lib/pg_ext.rb
>
> that contains the methods. Then, at the bottom of
> {RAILS_ROOT}/config/environment.rb, I have
>
> require 'pg_ext'
>
> Remember to restart the server or console after making changes to the
> environment.
You can also use the dependency loading facility of rails.
Write a module in the lib directory :
# #{rails_root}/lib/pg_ext.rb
module PgExt
def foo
# ...
end
end
And simply call `PgExt.foo` in the migration file. No configuration needed.
--
Gabriel Laskar <[EMAIL PROTECTED]>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---