This project is archived and is in readonly mode.

#6524 new
Chris Anderson

strange behaviour with select and model method

Reported by Chris Anderson | March 4th, 2011 @ 06:49 PM

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

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages