This project is archived and is in readonly mode.

#2181 ✓resolved
Sam Granieri

Default Scope with conditions on create

Reported by Sam Granieri | March 9th, 2009 @ 04:30 PM | in 2.x

I noticed something really weird with default scope.

In one scenario, imagine if you have a model named Car, with a string attribute called color.

By default, you'd want to search on blue or red cars

The class would look like this

class Car
  default_scope :conditions=>{:color=>"Red".."Blue"}

If you run this through a controller, you wont be able to create a new car.

Also, I've seen default scope complain if you pass in sql

Is this something that merits a patch?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket



Referenced by