arel
ActiveRecord/Arel query resolves to something weird when attempt to order
I\'m attempting a transition from MySQL to what seems to be the stricter and less Rails-friendly PostgreSQL.[详细]
2023-02-09 11:26 分类:问答rails Active record selection
Q: all post and related comments selection in one query, loading comments relation into p.comments, but select only title from comments[详细]
2023-02-08 01:58 分类:问答rails3 unscoped within the model gets overriden by default_scope
I have this model 开发者_StackOverflow社区 User.rb default_scope :order => \'users.created_at DESC\'[详细]
2023-02-07 16:27 分类:问答How can I eager load the most recent object in a has_many relationship?
I have a rails 3 app that has models like categories and posts. Category has_many :posts Post belongs_to :category[详细]
2023-02-05 21:38 分类:问答ActiveRecord keeping scope encapsulated
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[详细]
2023-02-05 21:15 分类:问答Rails removing 's' off the word business as it thinks it is a plural?
Category.where(:name => params[:category]).joins(:business) Gets me: uninitialized constant Category::B开发者_Go百科usines[详细]
2023-02-05 04:04 分类:问答Weird thing with select in Rails3
In my app, I have the line Feature.all(:select=>\"name\", :conditions=> [\'id IN (?)\', feature_id_array]).map(&:name)[详细]
2023-02-04 09:36 分类:问答Nested sql queries in rails when :has_and_belongst_to_many
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[详细]
2023-02-03 18:54 分类:问答How to exclude an array of ids from query in Rails (using ActiveRecord)?
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:[详细]
2023-02-02 18:03 分类:问答How do I perform a search in Rails3?
I\'m aware that I can search queries by calling where() on a model as follows: Post.where(:title => \'My First Post\')[详细]
2023-02-02 17:59 分类:问答