[Rails] Re: Initializers - Metaprogramming (uninitialized constant Net (NameError)
On May 2, 6:36 pm, Erico Fusco <ericopfu...@gmail.com> wrote:
> Sorry my ignorance Frederick, how can I do that ?
>
> Just for you know, this class is native from Ruby.
>
require 'net/smtp'
Just because something is part of the ruby standard library doesn't
mean it is loaded all the time - would be rather wasteful to do that.
Fred
> Thank you.
>
> On 2 maio, 13:58, Frederick Cheung <frederick.che...@gmail.com> wrote:
>
>
>
> > On May 2, 5:19 pm, Erico Fusco <ericopfu...@gmail.com> wrote:> Hi guys,
>
> > > I´m trying to change a SMTP method on my rails application creating a
> > > file on initializers folder, but I'm getting this error: uninitialized
> > > constant Net (NameError)
>
> > > I don't know if I'm doing this right, here it's my .rb file I put on
> > > initializers folder.
>
> > sounds like net/smtp isn't yet loaded - try requiring it first.
>
> > Fred
>
> > > initializers/test.rb
> > > Net::SMTP.class_eval do
> > > def rcptto(to_addr)
> > > if $SAFE > 0
> > > raise SecurityError, 'tainted to_addr' if to_addr.tainted?
> > > end
> > > getok("RCPT TO:<#{to_addr}>")
> > > end
> > > end
>
> > > Thanks guys...
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home