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:
-
Symbol as array index
This is on the line @range = options[:range] -
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