Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6943051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:06:19+00:00 2026-05-27T13:06:19+00:00

I have an application (RoR 3.1) where a user can change the position of

  • 0

I have an application (RoR 3.1) where a user can change the position of a google maps marker of a business (handled with “business controller”). After he clicks on the “Save new position” button the user should be redirected to the business#show page. But he isn’t although the server log shows that business#show is rendered. The position is saved correctly in the database anyhow but I’m remaining on the business#updatemap page.

Here is the code of the view where the user can change the map position:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?v=3.6&sensor=false&region=IN"></script>
<script type="text/javascript">
  function initialize() {

    var myLatlng = new google.maps.LatLng(<%= @business.latitude %>, <%= @business.longitude %>);

    var options = {
      zoom: 14,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    var map = new google.maps.Map(document.getElementById("map_canvas"), options);

    var marker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        draggable:true
    });

    google.maps.event.addListener(
        marker,
        'drag',
        function() {
            document.getElementById('business_latitude').value = marker.position.lat();
            document.getElementById('business_longitude').value = marker.position.lng();
        });
  }
</script>

<body onload="initialize()">
<div id="map_canvas" style="width:500px;height:500px;">
</div>

<%= form_for :business, :url => { :action => "updatemap" }, :remote => true do |f| %>
  <%= f.hidden_field :latitude %>
  <%= f.hidden_field :longitude %>
  <%= f.submit %>
<% end %>

This is the relevant part of the business controller:

 def updatemap
    @business = Business.find(params[:id])
    if @business.update_attributes(params[:business])
      redirect_to @business, :flash => { :success => "The business was 
                                                      successfully updated!" }
    else
      redirect_to root_path
    end
  end

And this is the server log:

Started GET "/businesses/173-New-Delhi-wrewerwer" for 127.0.0.1 at 2011-12-06 13:22:58 +0100
  Processing by BusinessesController#show as HTML
  Parameters: {"id"=>"173-New-Delhi-wrewerwer"}
  Business Load (0.3ms)  SELECT `businesses`.* FROM `businesses` WHERE `businesses`.`id` = 173 ORDER BY businesses.business_name ASC LIMIT 1
  City Load (0.1ms)  SELECT `cities`.* FROM `cities` WHERE `cities`.`id` = 2 LIMIT 1
  State Load (0.3ms)  SELECT `states`.* FROM `states` WHERE `states`.`id` = 10 ORDER BY states.name ASC LIMIT 1
  CACHE (0.0ms)  SELECT `cities`.* FROM `cities` WHERE `cities`.`id` = 2 LIMIT 1
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `cities`.* FROM `cities` WHERE `cities`.`id` = 2 LIMIT 1
   (0.1ms)  SELECT COUNT(*) FROM `images` WHERE `images`.`business_id` = 173
  Image Load (0.6ms)  SELECT `images`.* FROM `images` WHERE `images`.`business_id` = 173
  CACHE (0.0ms)  SELECT `cities`.* FROM `cities` WHERE `cities`.`id` = 2 LIMIT 1
  CACHE (0.0ms)  SELECT `cities`.* FROM `cities` WHERE `cities`.`id` = 2 LIMIT 1
  CACHE (0.0ms)  SELECT `cities`.* FROM `cities` WHERE `cities`.`id` = 2 LIMIT 1
Rendered businesses/show.html.haml within layouts/application (49.9ms)
Rendered layouts/_stylesheets.html.erb (1.1ms)
Rendered layouts/_header.html.haml (3.3ms)
Rendered layouts/_footer.html.haml (1.1ms)
Completed 200 OK in 155ms (Views: 61.0ms | ActiveRecord: 8.1ms)

So it says that business/show.html.haml was rendered, but I’m still on the page where I can change the position of the map.

Has anyone an idea of what is going on here? I guess this is a really simple issue but since I’m quite new to coding any help is welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:06:20+00:00Added an answer on May 27, 2026 at 1:06 pm

    You need to remove :remote => true from your form in order to make redirection works.

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've developed a RoR application, and want to integrate Google Analytics so I can
I'm new to the Google Maps API and have just taken over an RoR
I have a RoR application (ruby v1.8.7; rails v2.3.5) that is caching a page
I have a RoR application running on box1...it obviously has Ruby, RubyGems, and Rails
I have application that is up more than 3 days. I can see in
I have Application X (not mine!) with Subform x1, x2, x3. How can I
Background I have a ror application which is continuously recording and showing on a
We have RoR application and we are planning to make js interface(extjs or closure)
My application will basically accept user input via the main(String[] args) method. I have
I have RoR 3.0 web application which is acting as an OAuth API provider.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.