# Newbie stuff: Adding a New Library Class

**URL:** <https://www.ruby-forum.com/t/newbie-stuff-adding-a-new-library-class/56018>\
**Category:** Rails\
**Created:** [March 27, 2006, 12:08pm UTC](https://www.ruby-forum.com/t/newbie-stuff-adding-a-new-library-class/56018 "2006-03-27T12:08:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajesh\_GS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/5e9695/32.png) [@Rajesh\_GS](https://www.ruby-forum.com/u/Rajesh_GS)\
**Post date:** [March 27, 2006, 12:08pm UTC](https://www.ruby-forum.com/t/newbie-stuff-adding-a-new-library-class/56018/1 "2006-03-27T12:08:56Z")

</div>

Hi

I have been successful in playing around with model, views and  
controllers in Rails. Along the way, I learnt that some of the reusable  
stuff could be made library classes. I want to create a lib which will  
render a form and form elements.

I created a class Mylib.rb in /lib folder.  
The class tructure looks like this

class Mylib  
helper FormTagHelper

```
attr_accessor :name, :range, :name, :category, :sort, :page, 

```

:height, :width …

```
def initialize(name, options = {})
    @name = name
    @range = options[:range]
    @category = options[:category]
    ...
    ...
    ...
end
....
....

```

When I run this code, I get two errors:

1. Symbol as array index  
This is on the line @range = options[:range]

2. And further, I want to use form tag helpers in my class. I need to  
use select\_tag, options\_for\_select in the lib. I am not sure how to do  
this. Please, please someone help me in the right direction.

Thanks

-R
