I have a model:
class Mymodel < ActiveRecord :: Base
attr_accessible :the_date, :the_time, :the_event
def the_date
...
end
def the_time
...
end
def the_event
...
end
...
end
My controller holds a array of methods names, which is used by view:
class Mycontroller < ApplicationController
@methods=['the_date', 'the_time', 'the_event']
...
end
in my view index.html.haml, I would like to dynamically access the model methods:
%td
-index=SOME_USER_INPUT
=mymodel.@methods[index] /IT DOES NOT WORK HERE!!
But, I can not dynamically call the model methods in this way: mymodel.@methods[index]
, how to have dynamical method call based on my sample code??