Forum: Ruby on Rails Layout Confusion

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9f4a65c520a69cd357d830661e172272?d=identicon&s=25 JannaB (Guest)
on 2009-05-21 16:49
(Received via mailing list)
I am using AuthLogic and ActiveScaffold together in a Rails App.
Essentailly, through AuthLogic (using Railscast 167 tutorial) I create
a username/password signon screen, which has a link in the upper right
to allow one to Register should they not presently posses a username/
password. Very straightforward. If they click to Register, it takes
then to associate/edit/.

Here is how my associate/edit/id looks

http://www.parametricplanet.com/edit0.JPG

note that this is rendered from erb's in the views/associate
directory, inside of  /views/layouts/application.html.erb.

Note that I am using Active Scaffold.
Here is how it looks when displayed from within the edit functionality
of active_scaffold:

http://www.parametricplanet.com/edit.JPG

Notice that the  "Register | Login" and copyright notice are
incorporated into the inner edit form, because of  /views/layouts/
application.html.erb. How can  I set things up so that the inner form,
for editing or creating a record, does not do this?

here is my associate_controller.rb :

class AssociateController < ApplicationController
layout "application.html.erb"

  active_scaffold :associate do |config|
      config.label = "Associates"
      config.list.columns  =
[:lastname, :firstname, :username, :email, :branch]
      #list.columns.exclude :comments
      config.columns[:state].form_ui = :usa_state
      config.columns[:country].form_ui = :country
      list.sorting = {:lastname => 'ASC'}
      config.actions.exclude :show #, :delete
      config.actions.swap :search, :live_search

    end

        def new
            @associate = Associate.new
          end

          def create
            @associate = Associate.new(params[:associate])
            if @associate.save
              flash[:notice] = "Registration successful."
              redirect_to root_url
            else
              render :action => 'new'
            end
          end

          def edit
            @associate = Associate.find(params[:id])#current_associate
          end

          def update
            @associate = Associate.find(params[:id])#current_associate
            if @associate.update_attributes(params[:associate])
              flash[:notice] = "Successfully updated profile."
              redirect_to root_url
            else
              render :action => 'edit'
            end
          end
end

here is my /views/layouts/application.html.erb :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
//<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
// <head>
//    <%= javascript_include_tag :defaults %>
//    <%= active_scaffold_includes %>
//    <title><%= h(yield(:title) || @page_title ||"Untitled") %></
title>
//    <%= stylesheet_link_tag 'application' %>
//    <%= yield(:head) %>
//  </head>
//  <body>
//    <div id="container">
//      <div id="user_nav">
//        <% if current_associate %>
//          <%= link_to "Edit Profile", edit_associate_path(:current)
%> |
//          <%= link_to "Logout", logout_path %>
//        <% else %>
//          <%= link_to "Register", :controller =>
"associate", :action => "new" %> |
//          <%= link_to "Login", login_path %>
//        <% end %>
//      </div>

//      <% flash.each do |name, msg| %>
//        <%= content_tag :div, msg, :id => "flash_#{name}" %>
//      <% end %>


//      <% if show_title? %>
//        <h1><%=h yield(:title) %></h1>
//      <% end %>


//      <%= yield %>/
//    </div>
//    <p>Copyright © 2009/</p>
//  </body>
//</html>
>
This topic is locked and can not be replied to.