Strange change in form_tag behavior from 2.0 to 2.1?

I’ve used an approach frequently in the past where I create a method
in the model that when passed parameters from a selection form returns
a modified result set.
As an example the routine in the model looks like this;

def self.find_by_search(params) (shortened for easy reading)
where = []
unless params[:agency].blank?
where << “agency_id = :agency”
end
if where.empty?
find(:all,
:order => params[:order])
else
find(:all,
:conditions => [where.join(" AND "), params],
:order => params[:order])
end
end

Then the controller uses this model/method to modify the result set
based on the user’s entries.

def ecase_search
@title = “Search Cases”
return if params[:commit].nil?
@ecase = @account.ecases.find_by_search(params)
@ecases = @ecase.paginate :per_page => 8,
:page => params[:page]
render(:template => “evidence/ecases/index”)
end

The search form that is supposed to pass the params back to the
controller action looks like this;

<% form_tag( ecase_search_path, :method => “get”) do %> (shortened
for easier reading)

> <% @agencies = @account.agencies.find(:all) %> <% @agencies < '', :description => 'All') %> <% @selections = %w(agency_id incident_id officer evidences_count) %>
<%= "Search Field" %> <%= "Search Value" %>
<%= "Agency Code" %><%= select_tag(:agency, options_for_select(@agencies.collect { |c| [ c.description, c.id ] }), :style => "width:150px", :id => :indexselect) %>
<%= "Order By" %> <%= select_tag(:order, options_for_select(@selections), :style => "width:150px", :id => :indexselect) %>
<%= submit_tag "Find Results", :class => "submit" %>
<% end %>

The routing in routes.rb looks like this;

map.ecase_search ‘ecase_search’, :controller => ‘evidence/
ecases’, :action => ‘ecase_search’

The error I get when I try this approach is;

ActionController::MethodNotAllowed
Only get, head, post, put, and delete requests are allowed.

This approach worked wonderfully in 2.0 but now fails in 2.1. I had a
similar problem in 2.1 when I found that nested tables had to be
called differently in the form_for such as (<% form_for([@account,
@agency]) do |form| % )
Any thoughts are greatly appreciated.
Kathleen

You know what it was???
The route somehow was not high enough up in the routes.rb file? I have
no idea why this is as there’s not another route like this…but I just
thought I might make someone’s day a little easier.
Kathleen

On Jul 24, 12:25 pm, “[email protected][email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs