Wins Lin wrote in post #1105843:
> # In my "create" methon
> def create
>     require "myEmailValidator"
>     @result = EmailValidator.validate(params[:email_from_form])
> end
>
> It works, but maybe is there a better way to work with it?

Isn't it generally accepted practice to put require statements at the 
top of the file? It seem odd to me to put them inside a method as you've 
done here. Maybe I'm just used to treating require like import from 
other languages.

You may find this helpful:

http://reefpoints.dockyard.com/ruby/2012/02/14/love-your-lib-directory.html

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to