Strange routing(?) Issue

I have a Model event and the following two lines in routes.rb

1 - map.connect “events/:action”, :controller => ‘events’, :action => /
[a-z_]+/i
2 - map.resources :events, :has_many => :comments, :has_one
=> :address #, :collection => {:mapit => :get}

I have #1 so that I can call custom actions from a link_to_remote link
from my index page t0 update a div.

<%= link_to_remote “Map”, :method => “get”, :url => {:action =>
“mapit”, :controller => “events”} %>

Please see controller and rake routes output below.

Here is the problem,

With both #1 and #2 line in routes.rb active, if I click the Map link
nothing happens,
I get a 404 ActiveRecord::RecordNotFound in EventsController#mapit

Couldn't find Event without an ID
AND when I create a new

event i just get redirected back to events index page, no record gets
saved.

If I uncomment the regular event route i.e. #1, then I still get the
same error with the map link but now I can create and save new event
records.

Any ideas?

the events controller


def mapit
# render :text => “asit”
respond_to do
format.js {
render :update do |page|
page.replace_html “div_map”, “

Map here


end
}
end
end

def new
    @event = Event.new
    address = @event.build_address
    respond_to do |format|
        format.html # new.html.erb
        format.xml  { render :xml => @event }
    end
end

# GET /events/1/edit
def edit
    @event = Event.find(params[:id])

end

def create
    @event = Event.new(params[:event])
    #        @event.address = Address.new(params[:address])
    #        @event.address.cr
    @event.user_id = current_user.id;
    respond_to do |format|
        if @event.save
            flash[:notice] = 'Event was successfully created.'
            format.html { redirect_to(@event) }
            format.xml  { render :xml => @event, :status

=> :created, :location => @event }
else
format.html { render :action => “new” }
format.xml { render :xml => @event.errors, :status
=> :unprocessable_entity }
end
end
end


rake:routes output


change_authorization_rules GET /authorization_rules/
change(.:format)
{:action=>“change”, :controller=>“authorization_rules”}
graph_authorization_rules GET /authorization_rules/
graph(.:format)
{:action=>“graph”, :controller=>“authorization_rules”}
suggest_change_authorization_rules GET /authorization_rules/
suggest_change(.:format)
{:action=>“suggest_change”, :controller=>“authorization_rules”}
authorization_rules GET /
authorization_rules(.:format)
{:action=>“index”, :controller=>“authorization_rules”}
authorization_usages GET /
authorization_usages(.:format)
{:action=>“index”, :controller=>“authorization_usages”}
/
events/:action
{:controller=>“events”}
event_comments GET /events/:event_id/
comments(.:format)
{:action=>“index”, :controller=>“comments”}
POST /events/:event_id/
comments(.:format)
{:action=>“create”, :controller=>“comments”}
new_event_comment GET /events/:event_id/comments/
new(.:format) {:action=>“new”, :controller=>“comments”}
edit_event_comment GET /events/:event_id/
comments/:id/edit(.:format)
{:action=>“edit”, :controller=>“comments”}
event_comment GET /events/:event_id/
comments/:id(.:format)
{:action=>“show”, :controller=>“comments”}
PUT /events/:event_id/
comments/:id(.:format)
{:action=>“update”, :controller=>“comments”}
DELETE /events/:event_id/
comments/:id(.:format)
{:action=>“destroy”, :controller=>“comments”}
new_event_address GET /events/:event_id/address/
new(.:format) {:action=>“new”, :controller=>“addresses”}
edit_event_address GET /events/:event_id/address/
edit(.:format) {:action=>“edit”, :controller=>“addresses”}
event_address GET /events/:event_id/
address(.:format)
{:action=>“show”, :controller=>“addresses”}
PUT /events/:event_id/
address(.:format)
{:action=>“update”, :controller=>“addresses”}
DELETE /events/:event_id/
address(.:format)
{:action=>“destroy”, :controller=>“addresses”}
POST /events/:event_id/
address(.:format)
{:action=>“create”, :controller=>“addresses”}
events GET /
events(.:format)
{:action=>“index”, :controller=>“events”}
POST /
events(.:format)
{:action=>“create”, :controller=>“events”}
new_event GET /events/
new(.:format)
{:action=>“new”, :controller=>“events”}
edit_event GET /events/:id/
edit(.:format)
{:action=>“edit”, :controller=>“events”}
event GET /
events/:id(.:format)
{:action=>“show”, :controller=>“events”}
PUT /
events/:id(.:format)
{:action=>“update”, :controller=>“events”}
DELETE /
events/:id(.:format)
{:action=>“destroy”, :controller=>“events”}
login /
login
{:action=>“new”, :controller=>“user_sessions”}
logout /
logout
{:action=>“destroy”, :controller=>“user_sessions”}
user_sessions GET /
user_sessions(.:format)
{:action=>“index”, :controller=>“user_sessions”}
POST /
user_sessions(.:format)
{:action=>“create”, :controller=>“user_sessions”}
new_user_session GET /user_sessions/
new(.:format)
{:action=>“new”, :controller=>“user_sessions”}
edit_user_session GET /user_sessions/:id/
edit(.:format)
{:action=>“edit”, :controller=>“user_sessions”}
user_session GET /
user_sessions/:id(.:format)
{:action=>“show”, :controller=>“user_sessions”}
PUT /
user_sessions/:id(.:format)
{:action=>“update”, :controller=>“user_sessions”}
DELETE /
user_sessions/:id(.:format)
{:action=>“destroy”, :controller=>“user_sessions”}
role_users GET /roles/:role_id/
users(.:format)
{:action=>“index”, :controller=>“users”}
POST /roles/:role_id/
users(.:format)
{:action=>“create”, :controller=>“users”}
new_role_user GET /roles/:role_id/users/
new(.:format) {:action=>“new”, :controller=>“users”}
edit_role_user GET /roles/:role_id/users/:id/
edit(.:format) {:action=>“edit”, :controller=>“users”}
role_user GET /roles/:role_id/
users/:id(.:format)
{:action=>“show”, :controller=>“users”}
PUT /roles/:role_id/
users/:id(.:format)
{:action=>“update”, :controller=>“users”}
DELETE /roles/:role_id/
users/:id(.:format)
{:action=>“destroy”, :controller=>“users”}
role_assignments GET /roles/:role_id/
assignments(.:format)
{:action=>“index”, :controller=>“assignments”}
POST /roles/:role_id/
assignments(.:format)
{:action=>“create”, :controller=>“assignments”}
new_role_assignment GET /roles/:role_id/assignments/
new(.:format) {:action=>“new”, :controller=>“assignments”}
edit_role_assignment GET /roles/:role_id/
assignments/:id/edit(.:format)
{:action=>“edit”, :controller=>“assignments”}
role_assignment GET /roles/:role_id/
assignments/:id(.:format)
{:action=>“show”, :controller=>“assignments”}
PUT /roles/:role_id/
assignments/:id(.:format)
{:action=>“update”, :controller=>“assignments”}
DELETE /roles/:role_id/
assignments/:id(.:format)
{:action=>“destroy”, :controller=>“assignments”}
roles GET /
roles(.:format)
{:action=>“index”, :controller=>“roles”}
POST /
roles(.:format)
{:action=>“create”, :controller=>“roles”}
new_role GET /roles/
new(.:format)
{:action=>“new”, :controller=>“roles”}
edit_role GET /roles/:id/
edit(.:format)
{:action=>“edit”, :controller=>“roles”}
role GET /
roles/:id(.:format)
{:action=>“show”, :controller=>“roles”}
PUT /
roles/:id(.:format)
{:action=>“update”, :controller=>“roles”}
DELETE /
roles/:id(.:format)
{:action=>“destroy”, :controller=>“roles”}
user_roles GET /users/:user_id/
roles(.:format)
{:action=>“index”, :controller=>“roles”}
POST /users/:user_id/
roles(.:format)
{:action=>“create”, :controller=>“roles”}
new_user_role GET /users/:user_id/roles/
new(.:format) {:action=>“new”, :controller=>“roles”}
edit_user_role GET /users/:user_id/roles/:id/
edit(.:format) {:action=>“edit”, :controller=>“roles”}
user_role GET /users/:user_id/
roles/:id(.:format)
{:action=>“show”, :controller=>“roles”}
PUT /users/:user_id/
roles/:id(.:format)
{:action=>“update”, :controller=>“roles”}
DELETE /users/:user_id/
roles/:id(.:format)
{:action=>“destroy”, :controller=>“roles”}
user_friendships GET /users/:user_id/
friendships(.:format)
{:action=>“index”, :controller=>“friendships”}
POST /users/:user_id/
friendships(.:format)
{:action=>“create”, :controller=>“friendships”}
new_user_friendship GET /users/:user_id/friendships/
new(.:format) {:action=>“new”, :controller=>“friendships”}
edit_user_friendship GET /users/:user_id/
friendships/:id/edit(.:format)
{:action=>“edit”, :controller=>“friendships”}
user_friendship GET /users/:user_id/
friendships/:id(.:format)
{:action=>“show”, :controller=>“friendships”}
PUT /users/:user_id/
friendships/:id(.:format)
{:action=>“update”, :controller=>“friendships”}
DELETE /users/:user_id/
friendships/:id(.:format)
{:action=>“destroy”, :controller=>“friendships”}
user_friends GET /users/:user_id/
friends(.:format)
{:action=>“index”, :controller=>“friends”}
POST /users/:user_id/
friends(.:format)
{:action=>“create”, :controller=>“friends”}
new_user_friend GET /users/:user_id/friends/
new(.:format) {:action=>“new”, :controller=>“friends”}
edit_user_friend GET /users/:user_id/friends/:id/
edit(.:format) {:action=>“edit”, :controller=>“friends”}
user_friend GET /users/:user_id/
friends/:id(.:format)
{:action=>“show”, :controller=>“friends”}
PUT /users/:user_id/
friends/:id(.:format)
{:action=>“update”, :controller=>“friends”}
DELETE /users/:user_id/
friends/:id(.:format)
{:action=>“destroy”, :controller=>“friends”}
user_events GET /users/:user_id/
events(.:format)
{:action=>“index”, :controller=>“events”}
POST /users/:user_id/
events(.:format)
{:action=>“create”, :controller=>“events”}
new_user_event GET /users/:user_id/events/
new(.:format) {:action=>“new”, :controller=>“events”}
edit_user_event GET /users/:user_id/events/:id/
edit(.:format) {:action=>“edit”, :controller=>“events”}
user_event GET /users/:user_id/
events/:id(.:format)
{:action=>“show”, :controller=>“events”}
PUT /users/:user_id/
events/:id(.:format)
{:action=>“update”, :controller=>“events”}
DELETE /users/:user_id/
events/:id(.:format)
{:action=>“destroy”, :controller=>“events”}
user_articles GET /users/:user_id/
articles(.:format)
{:action=>“index”, :controller=>“articles”}
POST /users/:user_id/
articles(.:format)
{:action=>“create”, :controller=>“articles”}
new_user_article GET /users/:user_id/articles/
new(.:format) {:action=>“new”, :controller=>“articles”}
edit_user_article GET /users/:user_id/articles/:id/
edit(.:format) {:action=>“edit”, :controller=>“articles”}
user_article GET /users/:user_id/
articles/:id(.:format)
{:action=>“show”, :controller=>“articles”}
PUT /users/:user_id/
articles/:id(.:format)
{:action=>“update”, :controller=>“articles”}
DELETE /users/:user_id/
articles/:id(.:format)
{:action=>“destroy”, :controller=>“articles”}
user_comments GET /users/:user_id/
comments(.:format)
{:action=>“index”, :controller=>“comments”}
POST /users/:user_id/
comments(.:format)
{:action=>“create”, :controller=>“comments”}
new_user_comment GET /users/:user_id/comments/
new(.:format) {:action=>“new”, :controller=>“comments”}
edit_user_comment GET /users/:user_id/comments/:id/
edit(.:format) {:action=>“edit”, :controller=>“comments”}
user_comment GET /users/:user_id/
comments/:id(.:format)
{:action=>“show”, :controller=>“comments”}
PUT /users/:user_id/
comments/:id(.:format)
{:action=>“update”, :controller=>“comments”}
DELETE /users/:user_id/
comments/:id(.:format)
{:action=>“destroy”, :controller=>“comments”}
user_assignments GET /users/:user_id/
assignments(.:format)
{:action=>“index”, :controller=>“assignments”}
POST /users/:user_id/
assignments(.:format)
{:action=>“create”, :controller=>“assignments”}
new_user_assignment GET /users/:user_id/assignments/
new(.:format) {:action=>“new”, :controller=>“assignments”}
edit_user_assignment GET /users/:user_id/
assignments/:id/edit(.:format)
{:action=>“edit”, :controller=>“assignments”}
user_assignment GET /users/:user_id/
assignments/:id(.:format)
{:action=>“show”, :controller=>“assignments”}
PUT /users/:user_id/
assignments/:id(.:format)
{:action=>“update”, :controller=>“assignments”}
DELETE /users/:user_id/
assignments/:id(.:format)
{:action=>“destroy”, :controller=>“assignments”}
new_user_address GET /users/:user_id/address/
new(.:format) {:action=>“new”, :controller=>“addresses”}
edit_user_address GET /users/:user_id/address/
edit(.:format) {:action=>“edit”, :controller=>“addresses”}
user_address GET /users/:user_id/
address(.:format)
{:action=>“show”, :controller=>“addresses”}
PUT /users/:user_id/
address(.:format)
{:action=>“update”, :controller=>“addresses”}
DELETE /users/:user_id/
address(.:format)
{:action=>“destroy”, :controller=>“addresses”}
POST /users/:user_id/
address(.:format)
{:action=>“create”, :controller=>“addresses”}
users GET /
users(.:format)
{:action=>“index”, :controller=>“users”}
POST /
users(.:format)
{:action=>“create”, :controller=>“users”}
new_user GET /users/
new(.:format)
{:action=>“new”, :controller=>“users”}
edit_user GET /users/:id/
edit(.:format)
{:action=>“edit”, :controller=>“users”}
deactivate_user PUT /users/:id/
deactivate(.:format)
{:action=>“deactivate”, :controller=>“users”}
activate_user PUT /users/:id/
activate(.:format)
{:action=>“activate”, :controller=>“users”}
user GET /
users/:id(.:format)
{:action=>“show”, :controller=>“users”}
PUT /
users/:id(.:format)
{:action=>“update”, :controller=>“users”}
DELETE /
users/:id(.:format)
{:action=>“destroy”, :controller=>“users”}
comments GET /
comments(.:format)
{:action=>“index”, :controller=>“comments”}
POST /
comments(.:format)
{:action=>“create”, :controller=>“comments”}
new_comment GET /comments/
new(.:format)
{:action=>“new”, :controller=>“comments”}
edit_comment GET /comments/:id/
edit(.:format)
{:action=>“edit”, :controller=>“comments”}
comment GET /
comments/:id(.:format)
{:action=>“show”, :controller=>“comments”}
PUT /
comments/:id(.:format)
{:action=>“update”, :controller=>“comments”}
DELETE /
comments/:id(.:format)
{:action=>“destroy”, :controller=>“comments”}
article_comments GET /articles/:article_id/
comments(.:format)
{:action=>“index”, :controller=>“comments”}
POST /articles/:article_id/
comments(.:format)
{:action=>“create”, :controller=>“comments”}
new_article_comment GET /articles/:article_id/
comments/new(.:format) {:action=>“new”, :controller=>“comments”}
edit_article_comment GET /articles/:article_id/
comments/:id/edit(.:format) {:action=>“edit”, :controller=>“comments”}
article_comment GET /articles/:article_id/
comments/:id(.:format) {:action=>“show”, :controller=>“comments”}
PUT /articles/:article_id/
comments/:id(.:format)
{:action=>“update”, :controller=>“comments”}
DELETE /articles/:article_id/
comments/:id(.:format)
{:action=>“destroy”, :controller=>“comments”}
articles GET /
articles(.:format)
{:action=>“index”, :controller=>“articles”}
POST /
articles(.:format)
{:action=>“create”, :controller=>“articles”}
new_article GET /articles/
new(.:format)
{:action=>“new”, :controller=>“articles”}
edit_article GET /articles/:id/
edit(.:format)
{:action=>“edit”, :controller=>“articles”}
article GET /
articles/:id(.:format)
{:action=>“show”, :controller=>“articles”}
PUT /
articles/:id(.:format)
{:action=>“update”, :controller=>“articles”}
DELETE /
articles/:id(.:format)
{:action=>“destroy”, :controller=>“articles”}
friendships GET /
friendships(.:format)
{:action=>“index”, :controller=>“friendships”}
POST /
friendships(.:format)
{:action=>“create”, :controller=>“friendships”}
new_friendship GET /friendships/
new(.:format)
{:action=>“new”, :controller=>“friendships”}
edit_friendship GET /friendships/:id/
edit(.:format)
{:action=>“edit”, :controller=>“friendships”}
friendship GET /
friendships/:id(.:format)
{:action=>“show”, :controller=>“friendships”}
PUT /
friendships/:id(.:format)
{:action=>“update”, :controller=>“friendships”}
DELETE /
friendships/:id(.:format)
{:action=>“destroy”, :controller=>“friendships”}
assisgnments GET /
assisgnments(.:format)
{:action=>“index”, :controller=>“assisgnments”}
POST /
assisgnments(.:format)
{:action=>“create”, :controller=>“assisgnments”}
new_assisgnment GET /assisgnments/
new(.:format)
{:action=>“new”, :controller=>“assisgnments”}
edit_assisgnment GET /assisgnments/:id/
edit(.:format)
{:action=>“edit”, :controller=>“assisgnments”}
assisgnment GET /
assisgnments/:id(.:format)
{:action=>“show”, :controller=>“assisgnments”}
PUT /
assisgnments/:id(.:format)
{:action=>“update”, :controller=>“assisgnments”}
DELETE /
assisgnments/:id(.:format)
{:action=>“destroy”, :controller=>“assisgnments”}

root /
{:action=>“index”, :controller=>“home”}
/:controller/:action/:id
/:controller/:action/:id(.:format)