find_all is now deprecated...how do I convert my code?

I'm getting some deprecation warnings from some of my forms and I was wondering how exactly I would convert them to the new format so it's not deprecated. I tried to do what it suggested but it's not quite that easy...I appreciate any help. Thanks!

[SNIP]

My select box on my form: <p><label for="ticket[priority_id]">Priority</label><br/> <%= select('ticket','priority_id',Priority.find_all.collect {|p| [ p.priority, p.id ] }, { :prompt => "- Select -" }, { :style => "width: 150px" }) %></p>

Priority.find(:all).collect etc...

From the command line:

find . | grep -i "\.rb$" | xargs ruby -p -i -e 'gsub(/find_all/i, "find(:all)")'

Theron Parlin

From the command line:

find . | grep -i "\.rb$" | xargs ruby -p -i -e 'gsub(/find_all/i, "find(:all)")'

Haw haw. That's a joke, guys. Theron knows that your code should be so well-factored that all your find_all's only appear in very few places, easy to manually upgrade, and that each one will be too unique to submit do a 'sed' attack...

> My select box on my form: > <p><label for="ticket[priority_id]">Priority</label><br/> > <%= select('ticket','priority_id',Priority.find_all.collect {|p| [ > p.priority, p.id ] }, { :prompt => "- Select -" }, { :style => "width: > 150px" }) %></p>Priority.find(:all).collect etc...

And while we are on the subject of clean code, all that should be correctly blocked-out and indented, with named variables for intermediate values:

<p>    <label for="ticket[priority_id]">Priority</label><br/>    <%=      priorities = Priority.find_all.collect{|p| [ p.priority, p.id ] }      select 'ticket',                'priority_id',                priorities,                { :prompt => "- Select -" },                { :style => "width: 150px" }    %> </p>

Much easier to read, understand, and upgrade. Just because Ruby permits these ultra-crunched super-long lines that doesn't mean we should endure them. Or put them in the Rails books...

Good point Philip, however I had success with it when using it to change @session to session, @param to param, etc....