Need some help understanding partials, versus authentication

Hi,

I am using Rick O.'s restful_authentication plugin, using
activefx’s great tutorial (http://www.railsforum.com/viewtopic.php?
id=14216) which works well but I am trying to understand how to use
partial to modify the workings a bit.

What I want to do is rather than have the user click on a link to get
to a logjn screen, have the username/password/submit form/controls to
be on the home page.

What I did was break the login form out into a partial "/app/views/
session/_login_form.html.erb) like so:

<% form_tag session_path do %>

<% if logged_in? %> Logged in as: <%= link_to h(current_user.login.capitalize), user_path(current_user) %> <%= link_to 'Edit Profile', edit_user_path(current_user) %>   <%= link_to 'Change Password', change_password_path %>   <%= link_to 'Log Out', logout_url %> <% else %> Username <%= text_field_tag 'login' %> Password <%= password_field_tag 'password' %>   <%= submit_tag 'Log in' %> Remember me: <%= check_box_tag 'remember_me' %> &nbsp <%= link_to 'Sign Up', new_user_path %>     <%= link_to 'Forgot Password?', forgot_password_path %> <% end %> <% end %>

I’m using an application template to allow me to have a common style,
etc for all my pages; the conditional code here shows the login form
items if you’re not logged in; if you are logged in it shows your user
name a a couple of links to edit your profit, change your password,
etc. It’s in controllers/views/layout/application.html.erb .

On this common template, I call the partial like this:

    <%= render :partial => "/sessions/login_form", :locals

=>{:login => “login”, :password =>“password” } %>

Everything shows up ok, but when I click the login button, I get sent
to the old login template (i.e., the one you’d get to if you went to
http://localhost:3001/session/new ) which of course, since I am using
am app template, shows up on the body area of the template… and the
user isn’t logged in.

Is there something basic I am not getting about how to use a partial
to get a user logged in this way…?

Any advice would be appreciated!

_David

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs