Trouble with pagaination and conditional statements

i am trying to call this in my controller

if(maincategory == ‘sale’)
@pages, @viewobj = paginate_collection Sale.get_all_sales, :page =>
@params[:page]
end

if(maincategory == ‘job’)
@pages, @viewobj = paginate_collection Job.get_all_jobs, :page =>
@params[:page]
end

etc…

but for some reason, when i click on the page link number, i get a nil
error. however, when i just put the
@pages, @viewobj = … outside of the if statement, everything works
fine. i guess the maincategory field gets reset maybe?

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