Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

strange behaviour with select and model method

#6524

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

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

State: new
Milestone: none
Assigned to: nobody
Importance: none