So i try to follow the RailsCast and got this, but nothing is
happening.
model/comment.rb --------------------------
def self.between_profiles profile1, profile2, search, page
find(:all, {
:per_page => 3, :page => page,
:order => 'name',
:conditions => [
"(profile_id=? and commentable_id=?) or (profile_id=? and
commentable_id=?) and commentable_type='Profile'",
profile1.id, profile2.id, profile2.id, profile1.id,'name
like ?', "%#{search}%"]
})
end
controller/comments_controller.rb ---------------------------
def index
@comments = Comment.search(params[:search], params[:page])
@comments = Comment.between_profiles(@p, @profile).paginate(:page
=> @page, :per_page => @per_page)
redirect_to @p and return if @p == @profile
respond_to do |wants|
wants.html {render}
wants.rss {render :layout=>false}
end
end
views/comments/index.html.erb -----------------------
<%= will_paginate @comments %>
those are my code.
On Apr 21, 5:50 am, Bharat <[email protected]> wrote:
> Post your code and the scenario, without it, it is difficult to help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Lovd by Less" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/lovdbyless?hl=en
Who loves ya baby?
-~----------~----~----~----~------~----~------~--~---