I\'m attempting a transition from MySQL to what seems to be the stricter and less Rails-friendly PostgreSQL.
Q: all post and related comments selection in one query, loading comments relation into p.comments, but select only title from comments
I have this model 开发者_StackOverflow社区 User.rb default_scope :order => \'users.created_at DESC\'
I have a rails 3 app that has models like categories and posts. Category has_many :posts Post belongs_to :category
I have two models, foo and bar, foo has many bars. Bar is an event that happens for a given period of time, so I\'d like a method or scope that returns an ActiveRecord::Relation representing the foos
Category.where(:name => params[:category]).joins(:business) Gets me: uninitialized constant Category::B开发者_Go百科usines
In my app, I have the line Feature.all(:select=>\"name\", :conditions=> [\'id IN (?)\', feature_id_array]).map(&:name)
In my application I the next task that has not already been done by a user. I have Three models, A Book that has many Tasks and then I have a User that has has and belongs to many tasks. The table tas
I would like to perform an ActiveRecord query that returns all records except those records that have certain ids.The ids I would like excluded are stored in an array.So:
I\'m aware that I can search queries by calling where() on a model as follows: Post.where(:title => \'My First Post\')