In our application we have two models, Stores and Offers. Stores are geocoded using the \'geocoder\' gem
Given the following two classes: class Location < ActiveRecord::Base belongs_to :holiday_schedule validates :name, :presence => true, :uniqueness => {:case_sensitive => false}
This named scope is working fine. named_scope :search, lambda {|search_txt| { :conditions => [\"field1 like ? or field2 like ? or field3 like ?\",\"#{search_txt}%\",\"#{search_txt}%\",\"#{search_t
I have an object JobBreakdown that has_one :invoice.If a JobBreakdown has an invoice (i.e. invoice_id is not nil) 开发者_运维知识库then it is considered INVOICED.If not, it is consider UNINVOICED.User
I\'d like to convert this method to a scope in rails so I could call something like Batch.all_completed and it would return all batches that met the criteria in the method:
Given the following code: named_scope :by_order, :order => \'priority ASC\' do def total_points self.sum(\'point_value\')
I\'m using the latest mongoid... How do I do the mongoid equivalent of this active record named_scope:
I can return a collection of objects, with only one (:limit => 1) but is there a way to return the .first() object only, like not within a collection?
I have the following nested if statement hairball, I\'m wondering if there is a more efficient way of writing this code (less lines of code that doesn\'t require so many conditionals)
In my ApplicationController I have the demo_mode? method (which returns true when the currently logged in user type is \"demo\").