title: check if function is valid to prevent 'undefined method error' in rails
body: <p>I am using a gem, will_paginate, to paginate contents on a rails site.</p>
  
  <p>It's usage is: (from the official example)</p>
  
  <pre><code>## perform a paginated query:
  @posts = Post.paginate(:page =&gt; params[:page])
  
  # or, use an explicit "per page" limit:
  Post.paginate(:page =&gt; params[:page], :per_page =&gt; 30)
  
  ## render page links in the view:
  &lt;%= will_paginate @posts %&gt;
  </code></pre>
  
  <p>Now in some views, I will need the pagination but some views I don't. So when using a common layout to render out the content, the pages without pagination will display an error.</p>
  
  <blockquote>
    <p>will_paginate undefined method error</p>
  </blockquote>
  
  <p>Is there a way to check if will_paginate is a valid function before it the view tries to display it?</p>
  
  <p>Thanks in advance,</p>