I am actually looking for a gem that provides time based pagination.
Like I have payments table, which have :payment_schaduled_on field.
And admin wants to see the entries divided on weekly bases.
Like
Payments between Time.now and Time.now+1.week.
Does any pagination gem provides this type of pagination or I have to create my own.
Thanks in Advance
Related
We have a series of products that are subscription based. ie: first 7 days free, then a monthly or annual fee with a start date and finish date. Is this possible ? and could we drive this through the REST API ?
Moving my comment to answer -
I would like to second #KimballRobinson's comments. It might be possible. The REST API by itself gives you access to store data. You can create products and maintain them. In your case, things to consider - what is the product taxonomy like and can it be defined as custom fields or something of that sort. Maybe you can set it up in a way such that you charge/invoice the customer for the same product every month or annually. There are ways in which you can implement subscription. If you define details more on the scope of what you are trying to accomplish, it will be easier to figure out
I have an where users can create an account and then create an invoice. More international users are using the app which means I need to allow them to set a currency from a dropdown and that's used on their invoices. I'm using number_to_currency everywhere currently, but how do I use that if say the currency code for a user is ES using the relationship current_user.currencies.name?
Ok I figured it out
Install this gem https://github.com/svenfuchs/rails-i18n
From here always use this format now number_to_currency(100,:locale=>'en-GB') you can choose from the list of formats here: https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale
How are we supposed to paginate through the venuehistory (https://developer.foursquare.com/docs/users/venuehistory) endpoint? In the docs, it mentions two parameters, beforeTimestamp and afterTimestamp, but the result set contains no reference timestamp points to paginate from. Am I missing something?
Background
I'm testing currently testing on an account with 22 items, so perhaps the pagination hasn't kicked in yet, but it would still be nice to cover this scenario. Thanks!
/users/venuehistory returns the user's whole venuehistory, so typically you do not need to paginate it. The beforeTimestamp and afterTimestamp are used if you want to only show history from a certain time period (such as only showing check-ins in January, for a calendar view of check-ins).
Is it possible to sort users by how much karma they have from getting votes on their voteable objects in the thumbs_up Rails gem? If anyone could detail the scope code required I would greatly appreciate it.
Easiest way to do this would be to have a column in the users table that stores the total amount of karma points a user has.
Set the default to 0. And then in your karma_controller, you can put a after_save call back that updates the associated user's karma_count field every time that user is rated.
Then all you need to do is User.order("karma_count asc")
That should be enough to point you in the right direction.
In my RoR 3 project, I am trying to have a way of doing reviews for a model. Kind of like amazon, where the user can review a product as well as rate it. For this, I chose ajaxful-rating & acts_as_commentable plugins. However, I am running into the problem that when the user clicks on a star rating (via ajaxful-rating), the rate function, automatically adds the db row to the "rate" table, therefore it will be able to exist without a comment attached to it which is not what I want. It also doesn't seem logical to rewrite the ajaxful functionality and I have a feeling that this functionality should exist somewhere out there, but I cant find any gem or plugin out there.
Has anyone out there done something like this before?
Why not link the rating model to the comment in a one to one relationship, then you can calculate the product's average rating by averaging the ratings of all of the comments on that product?