ActiveRecord select a string field has a certain length in Rails 3? -
i've got series of posts , select posts title size lesser 30, how that?
posts.where("len(title) < 30")?
this should work:
post.where("length(title) < 30")
you're correctly using #where shorthand :conditions in rails 3. can pass in snippet works in local sql directly.
just remember activerecord model classes singular convention.
Comments
Post a Comment