I am selecting records from the database using find. Then I delete
records out of the array, that I don’t want. That means I have fewer
records in my array then after the find. Therefore I cannot put the
:page => {:size => 15, :current => page}
into my find.
How would I do it, if I have the following code to tell my pagination
the number of records?
@images = Image.find(params[:keyword])
if @images.empty?
flash[:notice] = “No Images found”
else @images.reject { |image| image.owner.id != @owner.id }
end
You are right, but I am using find_fulltext and I don’t know, how to
join several tables with find_fulltext as well as have two arguments
like “keyword” and “owner_id”. Also, I don’t know how to add the
pagination stuff in there. My sql query would look like this:
select value
from fulltext_rows f, images i
where f.fulltextable_type = “Image” and
f.value like “%params{:keyword]%” and
f.fulltextable.id = i.image.id and
i.image.type = null and
i.owner_id = owner_id;
Thank you!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.