I'm having trouble passing context data with a request.  Rails keeps
complaining that it can't convert string to integer which is
questionable in and of it's self.  Origionally the data was being
added to the query string as a string so I thought it might be an
encapsulation issue and sent them as actual integers but it seems to
make no difference.  Here is the code:


This is the action in the first controller:

        def show
                @jobs = Job.all(:conditions => ["city_id = ? AND region_id = ? 
AND
country_id = ?", params[:city], params[:region], params[:country]])
                @city = City.find(params["city"])
                @region = Region.find(params["region"])
                @country = Country.find(params["country"])
                @companies = []
                @titles = []

                @jobs.each do |job|
                        @companies << job.company
                end

                @companies.uniq!

                @jobs.each do |job|
                        @titles << job.title
                end

                @titles.uniq!
        end


This is the link that is causing the problem (it is in the show view
for the action above):

<%= link_to title, by_title_jobs_url(:title => title, :location =>
[:city => @city.id, :region => @region.id, :country => @country.id])
%>



And here is the action being called by the link:

        def by_title
                if params[:location]
                        @jobs = Job.find(:all, :conditions => ["title = ? AND 
city_id = ?
AND region_id = ? AND country_id = ?", params["title"], params
["location"]["city"], params["location"]["region"], params["location"]
["country"]])
                elsif params[:company]
                        @jobs = Job.find(:all, :conditions => ["title = ? AND 
company_id
= ?", params["title"], params["company"]])
                else
                        @jobs = Job.find(:all, :conditions => ["title = ?", 
params
["title"]])
                end
        end


I repeatedly get the following error message:

 TypeError in JobsController#by_title

can't convert String into Integer

RAILS_ROOT: /Users/fenris/Projects/Rails/jobsnob
Application Trace | Framework Trace | Full Trace

/Users/fenris/Projects/Rails/jobsnob/app/controllers/
jobs_controller.rb:46:in `[]'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to