# Handle coustom util classes

**URL:** <https://www.ruby-forum.com/t/handle-coustom-util-classes/178909>\
**Category:** Rails\
**Created:** [November 13, 2009, 10:45am UTC](https://www.ruby-forum.com/t/handle-coustom-util-classes/178909 "2009-11-13T10:45:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chinna\_gogulapati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f9ae1b/32.png) [@chinna\_gogulapati](https://www.ruby-forum.com/u/chinna_gogulapati)\
**Post date:** [November 13, 2009, 10:45am UTC](https://www.ruby-forum.com/t/handle-coustom-util-classes/178909/1 "2009-11-13T10:45:16Z")

</div>

Hi All,

I am new to Ruby, Basically am a java developer. I have webservice, i  
want to create a view which access the webservice and display result.  
For that i want to create a util class which access webservice and then  
access that class in view. so any one can give me an idea how to do this  
and where do i need to place all this files in ruby on rails.

Thanks in advance  
Chinna.

---

<div class="post-metadata">

**Author:** ![chinna\_gogulapati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f9ae1b/32.png) [@chinna\_gogulapati](https://www.ruby-forum.com/u/chinna_gogulapati)\
**Post date:** [November 13, 2009, 5:34pm UTC](https://www.ruby-forum.com/t/handle-coustom-util-classes/178909/2 "2009-11-13T17:34:01Z")

</div>

Try the RAILS\_ROOT/lib directory in your rails application. You should  
have  
access to it in the view as well as other sections.

On Fri, Nov 13, 2009 at 1:45 AM, Chinna Gogulapati \<  
removed\_email\_address@domain.invalid\> wrote:

> ## Chinna.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Darian Shimy

---

<div class="post-metadata">

**Author:** ![chinna\_gogulapati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f9ae1b/32.png) [@chinna\_gogulapati](https://www.ruby-forum.com/u/chinna_gogulapati)\
**Post date:** [November 14, 2009, 5:30am UTC](https://www.ruby-forum.com/t/handle-coustom-util-classes/178909/3 "2009-11-14T05:30:31Z")

</div>

Chinna Gogulapati wrote:

> Hi All,
> 
> I am new to Ruby, Basically am a java developer. I have webservice, i  
> want to create a view which access the webservice and display result.  
> For that i want to create a util class which access webservice and then  
> access that class in view. so any one can give me an idea how to do this

Don’t – you’ll break MVC. Instead, call the Web service in the  
controller, store the returned data in a variable, and read that  
variable in the view.

Have you looked at ActiveResource?

> and where do i need to place all this files in ruby on rails.

As others have said, the lib directory is generally a good place for  
utility classes that are not clearly models or helpers.

> Thanks in advance  
> Chinna.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
