Hi,
I'm kinda new to rails, could someone point me in the right direction?
I have a load of model names sitting in a table. Given a loop through those Model names, how do I call activerecord functions, like count, on each iteration dynamically to display summary info in each link?
In my activescaffold helper I have the following code that generates an error:
def tag_pivot_column(record) model = record.cube.gsub(/cube_/, 'tag_pivot_') model = model.singularize
# error here. How do I call activerecord given my actual model name is in the variable called "model"? num = model.count.to_s
# I am testing the line below, that shows the number of records in the link text link_to(model + " [" + num + "] ", "/" << record.cube.gsub(/cube_/, 'tag_pivot_'))
# original working line of code. # link_to(record.cube.gsub(/cube_/, 'tag_pivot_'), "/" << record.cube.gsub(/cube_/, 'tag_pivot_'))
end