This may be a very simple question, but I was trying to figure out how to do this in Rails 4.0. This is basically a basic application for users and messages with Userhas_many Post. Moreover, each column has a Boolean value :images_to_process. It indicates that all images belong to this Post, processed by delayed_jobs. You cannot display incomplete mail to avoid problems with downloading images. Here is the code that works for Rails 3:
class Post < ActiveRecord::Base
default_scope { where(is_deleted: false, images_to_process: 0) }
scope :everything, -> user {with_exclusive_scope { where(is_deleted: false, user_id: user) }}
As you may have noticed, it with_exclusive_scopedepreciates in Rails 4. I understand that it can be easier to do using the class method, but I do not want to give up the convenience of areas that can be linked and extended. What to do to replace with_exclusive_scopewith Rails 4?
Thanks for reading
source
share