Passing variable

def view_history
@posts = Post.search_by_requirement_id(params[:id], params[:page])
end

view_history.html.erb

<%= render :partial => :threads, :collection => @posts %>

The @posts in view_history doesn’t seem to make it to the
_threads.html.erb

Help!!

Thanks! =)

I believe there is a naming convention to follow if you’re using
the :collection option. if your collection is called @posts your
partial should be called the singular (_post.html.erb).

Try then

<%= render :partial => :post, :collection => @posts %>

I’m sure there are other (better) ways to do this… I’ve had success
following this convention tho.

HTH

SH

On Jul 31, 12:50 pm, Justin To [email protected]

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