How To: Remove a Partial

Right now I have a login partial that expands so the user can login.
After the user logins in I want that partial to go away.

What is the recommended way of doing this?

You just need to check to see if they’re logged in. Usually you’ll have
something in the session like this:

<% unless session[:logged_in] %>
<%=render :partial =>“login” %>
<% end %>

Something along those lines.

Brian H. wrote:

You just need to check to see if they’re logged in. Usually you’ll have
something in the session like this:

<% unless session[:logged_in] %>
<%=render :partial =>“login” %>
<% end %>

Something along those lines.

I didn’t explain right.

Go to say http://newsvine.com and try to login. When you select to
login, an AJAX style element comes down to allow you to login. After
you login, that element goes away. So if I render the partial “login”
in the rjs template associated with my login action, how do I remove
that template once they click the login button?

Do I just redirect them back to the home page? That doesn’t seem
elegant as it requires refreshing the entire page.

Ahhh.
your login form would be a form_remote tag.
Your controller that logs you in would render an rjs that does a
page.remove"login_form_id" or whatever.

Keep in mind also that when you do that, you force users to have
JS-enabled
browsers. In my opinion, an app should still work if JS is disabled or
not
available.