I have a model What am I trying to do that is preparing a scope for the However, instead of hardcoding, value Then put it in words: I have to admit all the posts The end is to be finished, and the status of the term is determined by the retireer value of each post category (i.e. posts in the category of films in 10 days, post in the games category in 5 days) etc. Is this possible? Do I need some type of join or something? Then just like it: or range from model like: posted (blog post) and a model named
category . Each term is
related_to a category. Each category has a feature called
holder , which specifies the amount of time before "ending", for example
movies_category.retainer = 30.days
post which searches for all the posts that have been "expired" for example, suppose I hardcoded the value of
30.days and it takes up all the categories (hence all the posts) The scope would have been:
scope: expired, lambda {where ("post.ctated_t
30.days , I want to get the value of the
holder from the post category and base it on the basis of something like that :
scope: expired, lambda {where ("post.ctated_t <", time.news-category.retainer}}
scope: expired, lambda {| Retainer | Where ("posts.created_at & lt ;?", Time.now - retainer)}
Post.expired ( Post category classifier)
def post post. Expiry term
Comments
Post a Comment