Redundant require lib statements

View: New views
3 Messages — Rating Filter:   Alert me  

Redundant require lib statements

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

Let's say in Model1 I require 'net/http', and in Model9 I also require
'net/http' because I forgot it was already required in Mode1, will that
cause a problem?

Should I redundantly require libs? Should I put require statements in a
common place? What's the consensus on that?


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


Re: Redundant require lib statements

by Frederick Cheung-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




On Nov 2, 1:59 pm, Fernando Perez <rails-mailing-l...@...>
wrote:
> Hi,
>
> Let's say in Model1 I require 'net/http', and in Model9 I also require
> 'net/http' because I forgot it was already required in Mode1, will that
> cause a problem?
>
Nope. The second require will be ignored (note that ruby just looks at
the string you pass require - you could force it to load net/http a
second time by doing require '/usr/local/lib/ruby/1.8/net/
http' (assuming that is where those files were on disk)).

Fred
> Should I redundantly require libs? Should I put require statements in a
> common place? What's the consensus on that?


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


Re: Redundant require lib statements

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



> Nope. The second require will be ignored (note that ruby just looks at
> the string you pass require
Super! Thanks for the clarification.
--
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 rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---