# How to include a ruby gem environment.rb file?

**URL:** <https://www.ruby-forum.com/t/how-to-include-a-ruby-gem-environment-rb-file/185714>\
**Category:** Rails\
**Created:** [March 24, 2010, 11:54pm UTC](https://www.ruby-forum.com/t/how-to-include-a-ruby-gem-environment-rb-file/185714 "2010-03-24T23:54:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [March 24, 2010, 11:54pm UTC](https://www.ruby-forum.com/t/how-to-include-a-ruby-gem-environment-rb-file/185714/1 "2010-03-24T23:54:29Z")

</div>

I’m doing a Web Service Based on a page I found  
([http://blog.complitech.net/web-services-basics-ruby-on-rails/](http://blog.complitech.net/web-services-basics-ruby-on-rails/)) using  
the rails version 2.3.4, the web service is already working, but when  
working on a version Previous:

RAILS\_GEM\_VERSION = '2 .0.2 'unless defined? RAILS\_GEM\_VERSION

I can not run the service.

On the previous page, there’s a part that says:

1. Next step is to add the gem to the conf / environment.rb so that is  
knows the correct gem actionwebservice

But if I do it, I can not run the service, the program sends this  
message:

C:/Users/usuario/Desktop/Servidor/test/config/environment.rb:26: private  
method `gem’ called for #Rails::Configuration:0x5c5dbcc  
(NoMethodError)

On this page:  
[http://api.rubyonrails.org/files/vendor/rails/railties/CHANGELOG.html](http://api.rubyonrails.org/files/vendor/rails/railties/CHANGELOG.html),  
is as follows:

# OLD open\_id\_authentication plugin init.rb require ‘Yadis’ require

‘openid’ ActionController:: Base.send: include OpenIdAuthentication

# NEW config.gem “ruby-openid”,: lib =\> “openid”,: version =\> “1.1.4”

config.gem “ruby-Yadis”,: lib =\> “Yadis”,: version =\> " 0.3.4 "

But I do not like change, please, I need help.

Thanks and regards.

---

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [March 25, 2010, 10:20pm UTC](https://www.ruby-forum.com/t/how-to-include-a-ruby-gem-environment-rb-file/185714/2 "2010-03-25T22:20:31Z")

</div>

Hi Jorge,

It’s because config.gem was first introduced in version 2.1 â€“ that’s why  
it  
doesn’t work in 2.0.2. You can see that in  
[http://api.rubyonrails.org/files/vendor/rails/railties/CHANGELOG.html](http://api.rubyonrails.org/files/vendor/rails/railties/CHANGELOG.html) by  
looking under “Added config.gem for specifying which gems are required  
by  
the application” and then moving up until you see the version.

/Lasse

2010/3/24 Jorge alejandro Mendoza torres [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [March 26, 2010, 4:40pm UTC](https://www.ruby-forum.com/t/how-to-include-a-ruby-gem-environment-rb-file/185714/3 "2010-03-26T16:40:58Z")

</div>

Hi Lasse.

I had an application in version 2.0.2 and I changed the version of the  
application already had, I thought it would be harder, but it was very  
easy.

On the page you mention, as I checked it, and is very helpful.

Thanks for responding.

---

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [March 26, 2010, 5:32pm UTC](https://www.ruby-forum.com/t/how-to-include-a-ruby-gem-environment-rb-file/185714/4 "2010-03-26T17:32:55Z")

</div>

Jorge,

Nice â€“ good you got it working 🙂

/Lasse

2010/3/26 Jorge alejandro Mendoza torres [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
