arel
Query for specific columns with rails 3
I want to run a query that only returns the columns that I specify. I haven\'t been able to find a good way to do this with rails 3. My first attempt was[详细]
2023-03-21 01:04 分类:问答Nested AREL queries in Rails
Simple question with a couple of simple models: class Contract < ActiveRecord::Base belongs_to :property[详细]
2023-03-20 08:21 分类:问答TypeError: Cannot visit Arel::Nodes::Union
I am performing a union over two subsets of my domain table with cnt being a local variable, using arel 2.0.9 and squeel 0.8.5 as query interface.[详细]
2023-03-17 18:12 分类:问答Rails/Arel - precedence when combining AREL predicates
A model has two attributes of i开发者_如何学Cnterest, forename and town. I want to search for Richard (London) and Brian (Madrid).[详细]
2023-03-16 10:36 分类:问答RAILS: safe parameterization of user input in Arel
So before anyone beats the hell out of me, I know how to do this when calling Arel methods. What I\'m curious about is if there is a way to simply get that sql injection safe version of the user input[详细]
2023-03-13 22:55 分类:问答How can I return a conditional boolean value in SQL
I have a stories table, a users table and a like开发者_JAVA技巧s table. I want to perform a query on the stories table which will include user_liked (BOOLEAN TRUE or FALSE) based on whether there is[详细]
2023-03-13 14:52 分类:问答Rails 3, Cancan, Multiple model searching with accessible_by
I have an issue where I\'m using cancan\'s accessible_by to return authorized Announcements, Resources, etc (based on a subject_id for a specific announcement, resource, etc). I would like to be able[详细]
2023-03-12 04:47 分类:问答Trying to call find_by_id on ActiveRecord::Relation, Arel exception
I\'m getting to grips wi开发者_如何转开发th Rails 3 and I can\'t seem to do a basic find from a result set. My code looks like the following:[详细]
2023-03-11 11:18 分类:问答How can you do a conditional where clause using AREL
How can you do a conditional where clause?I have a rake task that runs a query.Say I am building a query like so:[详细]
2023-03-10 09:35 分类:问答How to find a record that wasn't saved yet in Rails?
Say I have a record called Post that has many comments. Now I run the following code: p = Post.new p.comments.build(:title => \'great\')[详细]
2023-03-09 22:10 分类:问答