# Binding Google Map API key to the application

**URL:** <https://www.ruby-forum.com/t/binding-google-map-api-key-to-the-application/128610>\
**Category:** Rails\
**Created:** [February 9, 2008, 10:07am UTC](https://www.ruby-forum.com/t/binding-google-map-api-key-to-the-application/128610 "2008-02-09T10:07:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mukund](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Mukund](https://www.ruby-forum.com/u/Mukund)\
**Post date:** [February 9, 2008, 10:07am UTC](https://www.ruby-forum.com/t/binding-google-map-api-key-to-the-application/128610/1 "2008-02-09T10:07:43Z")

</div>

Is there is a way to bind the Google Maps API to the application  
instead of a controller / view? [http://abc/controller/action/parameter](http://abc/controller/action/parameter)  
doesn’t work as I am forced to use the key only for the action. If I  
can bind it to [http://abc/controller](http://abc/controller) instead it will be nice. Is  
there anyway to use routes to change the URL creation formation from  
action/id to action?id or something?

---

<div class="post-metadata">

**Author:** ![Mukund](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e8c25b/32.png) [@Mukund](https://www.ruby-forum.com/u/Mukund)\
**Post date:** [February 9, 2008, 10:27am UTC](https://www.ruby-forum.com/t/binding-google-map-api-key-to-the-application/128610/2 "2008-02-09T10:27:05Z")

</div>

I came up with this as a solution and it seems to work.

In routes.rb

map.connect ‘map/:action.:id’, :controller=\>“map”

So I can generate [http://abc/controller/action.parameter](http://abc/controller/action.parameter) instead of  
[http://abc/controller/action/parameter](http://abc/controller/action/parameter).

Any better suggestions?
