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
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:
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 :
//
//
// <%= javascript_include_tag :defaults %>
// <%= active_scaffold_includes %>
// <%= h(yield(:title) || @page_title ||“Untitled”) %></
title>
// <%= stylesheet_link_tag ‘application’ %>
// <%= yield(:head) %>
//
//
//
//
// <% 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 %>
//
// <% flash.each do |name, msg| %>
// <%= content_tag :div, msg, :id => “flash_#{name}” %>
// <% end %>
// <% if show_title? %>
//
<%=h yield(:title) %>
// <% end %>
// <%= yield %>/
//
//
Copyright © 2009/
//
//