Where should I put files to be sent via send_file in Rails 3?.Method not found error after updating Rails.Rails 4 - Foundation data-abide HTML5 validations working in one form, but not another.ArgumentError in Rails::WelcomeController#index.Replace div tag contents using ajax call to controller method.Are params values only available in the action you call it in? (Rails).ActionController::RoutingError when test custom devise controller.trouble passing through params with form_tag.Update content with link_to :remote => true.Table `schema_migrations` must either have a PRIMARY or SHARD key JSON response with multiline from rails is not parsed correctly.Cannot Sign In With CURL In Rails Using POST.Rails responding to different formats with AJAX request.Nested routes and CRUD operations with additional values for assciation in Rails.Rails app (production) interfacing with another rails app on same machine.Rails active record query with multiple associations.Ruby on Rails styling conflict with bootstrap.How to ignore hidden sheets when importing xlsx files with rails and roo.Rails App With No Sign Up But Has Log In.How to test a file attach with rspec in a rails project?.Exception handling with callback in rails. Rails saving callback value with Mailchimp api.Backbone Error Callback with Rails 4 Controller Response.Really Frustrating: validate method with callback in rails 4.How do I get a js countdown timer to trigger an event in ruby on rails.How I can invoke rails callback from separated script with ActiveRecord?.Ruby On Rails - Show pre-download page with a timer, initiate download in background once timer expires,then redirect to another view.Which rails ActiveRecord callback to sync with service (stripe) when creating a new record and still properly use errors?.Strange behavior when working with before_validation callback Short-time background jobs in Ruby or in Rails with a timer.Make a datetime countdown timer in rails.How to authenticate two types of user with same authentication callback in rails without devise gem?.Rails before_action with external authorization and callback.Rails before_update callback with nested attributes.Using Callback Rails with parameter - Ruby.How to make a countdown in ruby on rails with flipclock.js?.Callback with Acts-As-Taggable-On: Undefined method in Rails 3, works beautifully in Rails 2.3.Google Maps for Rails - Place Marker with User Location in Callback.I wont give you details about how to show the timer because that is just jQuery stuff. I want you to understand that countdown is only "visual" it means it is only for the user, it is a timer that only has sense on the client, in the backend you have your rake task that runs every minute looking for oferts that expired and inactivating them. Now if you need to display the countdown in real time, you can use a jQuery plugin like jQuer圜ountDown, I think there is a gem ready for the asset pipeline, you just need to follow instructions there. Great now if you run in your console rake oferts:inactivatethem you will inactivate all the oferts that already expired, you can make run this rake task every minute for example using a gem like whenever gem #config/schedule.rb Ofert.are_ready_to_inactive.find_each do |ofert| Then you just need to create a rake task for inactivate all those oferts that have expired: #lib/tasks/oferts.rakeĭesc "Inactive oferts with cron on certain time" So I supose you have an attribute called ends_at so we get all the oferts that their ends_at is less than the current time, it means all the oferts that expired. Where(active: true).where('ends_at <= ?', ) Great we in grupoly implemented such a system what you are describing.īut you are thinking it wrong, I will lead a solution for anybody that needs this.įirst of all I would create a scope in the oferts model like this: #ofert.rb
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |