I am trying to implement a lambda within a where() method in an ActiveRecord on Rails. Here is my code:
@applications.where { |app| !((calculate_days_ago(app.shipping_date) >= 10 && calculate_days_ago(:app.shipping_date) <= 19) || app.followup_calls.count == 0) }
Where @applications is an ActiveRecord (e.g. Application.all). But when I am trying to access it (e.g. order, where), it's type is change to WhereChain and I am having an exception:
undefined method `where' for #ActiveRecord::QueryMethods::WhereChain:0x6fb1000>
Is there a way I can implement a lambda expression on my where() condition with the proper return type?
Note: I came from a C# background and such lambda can be done like that, I am a newbie on Ruby on Rails. I am not aware that this community bash newbies with downvotes. I tried my best to make my question as clear as possible.