Ruby on Rails Wednesday, December 1, 2010

Hello Guest,

This is my full code, I want to update "datos", without the :remote =>
true the div is updated but the full page, and it does nothing.

application.html.erb

<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<%= csrf_meta_tag %>
<%= render 'layouts/stylesheets' %>
<%= javascript_include_tag :defaults %>
</head>

<body>
<div class="container">
<%= render 'layouts/header' %>
<div class ="datos" id="datos" >
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</div>
</body>
</html>


_header.html.erb

<header>
div class="menu_activado">
<% = link_to "Link", about_path,: remote => true%>
</div><!-- fin sub_cabecera -->
</header>

routes.rb

SampleApp::Application.routes.draw do
match '/about', :to => 'pages#about'
root :to => 'pages#home'
end

application_controller.rb

class ApplicationController < ActionController::Base
protect_from_forgery
include SessionsHelper
end


pages_controller.rb

class PagesController < ApplicationController
def home
@title = "Home"
end
def about
@title = "About"
end
end


application_helper.rb

module ApplicationHelper
base_title = "Example"
if @title.nil?
base_title
else
"#{base_title} | #{@title}"
end
end
end


Thank you.

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

No comments:

Post a Comment