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

Asked

Viewed 109 times

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 in the application and is working normally.

I ask: Since there is no Gem to be placed as a dependency there in Gemfile, is there any location I should use to load this "dependency", or I can continue giving the require where I need to use it?

2 answers

4


The way you’re doing it is correct. How open-uri is part of the standard Ruby library, you only need to require it when using.

1

I think it would be better if you used one helper and then just call it where you want to use the standard Ruby library.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.