strange behaviour with select and model method
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6524 Created by Chris Anderson - 2011-03-04 18:49:49 UTC
I'm tracking down performance issues in my app with Rails 3/Ruby 1.8.7. Found a strange issue with a select helper.
In my Job model...
def self.provinces
["AB", "BC", "SK"]
end
In my view I have in a single form...
<%= select 'time', 'class_code', Job.provinces, {:prompt => true}, {:class => "quick_entry_field"} %>
Results in...
Completed 200 OK in 2481ms (Views: 2312.6ms | ActiveRecord: 3.3ms | Sphinx: 0.0ms)
If I comment out the select I get...
Completed 200 OK in 435ms (Views: 265.0ms | ActiveRecord: 2.6ms | Sphinx: 0.0ms)
If I change the select to...
<%= select 'time', 'class_code', ["AB, "BC", "SK"], {:prompt => true}, {:class => "quick_entry_field"} %>
I get...
Completed 200 OK in 460ms (Views: 185.4ms | ActiveRecord: 2.7ms | Sphinx: 0.0ms)
So I see a 2 second increase in the time to fetch a simple array from the Job model. I freely admit I'm not a super experienced developer but I didn't see this issue in Rails 2.3.8 so it's baffling to me.
Thanks,
Chris