Is there a correct place to load native Ruby libraries when using Rails?

1

In certain functionality of my application, I need to use the "open-uri" library, which is native to Ruby and does not have a library for Ruby on Rails.

I'm using a require "open-uri" where I need it in the application and it's working normally.

I wonder: Since there is no gem to be placed as a dependency there in Gemfile, is there a place I should use to load this "dependency", or can I still give the require where I need to use it?

    
asked by anonymous 06.02.2014 / 20:29

2 answers

4

The way you are doing is correct. Because open-uri is part of the default Ruby library, you only need to request it when you use it.

    
07.02.2014 / 10:21
1

I think you'd better use a helper and then just call it where you want to use the default Ruby library.

    
12.03.2014 / 22:09