Hi,
I have not used Rails 3 yet and I see by your link_to helper that's
what you are using. Sorry if I can't be of much help, but I'll try to
point out what I see here that _could_ be wrong.
div class="menu_activado">
<% = link_to "Link", about_path,: remote => true%>
</div><!-- fin sub_cabecera -->
I am assuming the first div is missing the opening '<' because of a
mistake while copying the code?
A quick look at the Rails 3 API does not show how to indicate that you
want to update an HTML element's contents. Compare the link above with
the following, based on Rails 2.3.5:
<%= link_to_remote 'Get Time',
:update => 'current_time',
:url => {:action => 'get_time' },
:complete => visual_effect(:hightlight_shake, :current_time) %>
<div id="current_time"></div>
Notice the :update line? It indicates what HTML element to update with
the contents returned by the server. I can't see in the Rails 3 API
how to do that. Maybe it's explained somewhere else but not in the
link_to helper docs, as far as I could see.
<div class="container">
<%= render 'layouts/header' %>
<div class ="datos" id="datos" >
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</div>
I am not sure you really want to replace the contents of 'datos'. That
would replace the contents of the whole page except for the header and
the footer.
class PagesController < ApplicationController
def about
@title = "About"
end
end
From the link_to_remote Rails 2.3.8 API:
"Returns a link to a remote action defined by options[:url] (using the
url_for format) that’s called in the background using XMLHttpRequest.
The result of that request can then be inserted into a DOM object
whose id can be specified with options[:update]. Usually, the result
would be a partial prepared by the controller with render :partial."
The last sentence is the important one. Your 'about' action does not
render anything, it only assigns a value to a variable. The returned
value of your action will be the string 'About' and that should be
what you get in 'datos' after the code executes, supposing that the
div gets updated.