Johan Mickelin | 19 Jul 23:52

Routes


Hi there,
I'm having an issue with routes I frankly dont get.
I have a controller named map which takes in a hash string and converts
that to an actual url, works great

so localhost:3000/f3gg or whatever works fine

now, I have a controller which I want to use to add some records (needs
to go through AJAX)

I want two strings, from and to but nevermind that for now since I'm too
stupid to even get one string working

my routes.rb look like this

  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'
  map.connect ':map', :controller=>'map', :action=> 'index'
  map.connect ':from', :controller=>'share', :action=> 'index'
  map.connect '', :controller => "map"

the map one in the middle works fine, the controller looks like this:
(cut out all the irrelevant stuff)

class MapController < ApplicationController
  def index
    @map = getmap
  end
  def getmap
    if params['map'] then
     @map =  params['map']
     end
  end
end

now, for the "share" one I cant for the life of me get any values out of

class ShareController < ApplicationController
  def index
     if params['from'] then
      @map =  params['from']
    else
      @map = 'no params'
     end
  end
end

i've tried

http://localhost:3000/share/  - outputs no params
http://localhost:3000/share/index - ouputs no params
http://localhost:3000/share/index/[anything] - outputs no params
http://localhost:3000/share/[anything] - outputs "Exception caught -
Action not found"
but I dont want it to think its an action i want it to take the url
value, like it does in the maps one

any help with this would be greatly appreciated, and yes im not a very
experienced ROR developer.
--

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane