Closed amey1908 closed 10 years ago
@questions = initialize_grid(Question, per_page: 10)
Thanks Yuri for your prompt reply. I am not trying to limit the number of records per page, but I want to show only a total of 10 records. I have three tiers of subscription for my website. And the free user gets to see only 10 questions, while for paying customers, it would show all questions.
I see. Well, both .limit(10) and per_page: 10 translate to the same SQL, so I think that the plugin overwrites your limit with its implicit page limit. Could you maybe try
@questions = initialize_grid(Question.limit(10), per_page: 10)
?
Yuri, unfortunately it still shows all questions with 10 questions each page.
unfortunately it seems like it is not possible right now
Thanks Yuri for your prompt responses. One last thing - is there a way to restrict the number of records shown at the grid level (code where I write what columns to show in the grid) rather than the query level (code where I initialize the grid).
I don't understand the question. Why don't you use conditions in initialize_grid
?
I am not sure if there is a problem with my query or something else. I need to limit the number of records to 10 in the query shown below. However, wice grid comes up with all records. Any idea what's the issue?
The initialize_grid code: @questions = initialize_grid(Question.limit(10))