Question: I'm working through "Learning Rails by Example" tutorial by Michael Hartl(11.33).The relevant code is:

---

```
class PagesController < ApplicationController

  def home

    @title = "Home"
    if signed_in?
      @micropost = Micropost.new
       @feed_items = current_user.feed.paginate(:page => params[:page])
    end
  end

```

---

```
class User < ActiveRecord::Base

  def feed

    Micropost.all(:conditions => ["user_id = ?", id])

  end

```

---

```
module SessionsHelper

  def sign_in(user)

    user.remember_me!
    cookies[:remember_token] = { :value   => user.remember_token,
                                 :expires => 20.years.from_now.utc }
    self.current_user= user
  end

  def current_user=(user)

    @current_user = user
  end

  def current_user

    @current_user ||= user_from_remember_token
  end

```

---

@feed\_items is then rendered as a collection to "will\_paginate" and everything works fine.

My problem is that I cannot understand how the current\_user is passed to the "feed" method in the PagesController line ie

"@feed\_items = current\_user.feed.paginate(:page => params[:page])"

Any help will be greatly appreciated

Alan

Answer: 
> 
> Try this,This is a better way because if you use each function it will load and in the future when you have more than a thousand div it will take a long time to slide up and slide down.
> 
> 
> 

Example:

```
$('.collapsiblock').click(function(){
   $('.collapsiblock').not(this).slideUp();
   $(this).slideDown();
});

```
You could keep track of which element has already been clicked with your own jquery click handler and jquery's data(...) function. Then filter iterating your .collapsiblock items with jquery's filter (...) function to include the items you need.