Merge Request #72
← To merge requests
From
scope2method
into
master
Replace scope by class method to avoid conflict
It was raising the error "You tried to define a scope named "like_search" on the model "SoftwareInfo", but Active Record already defined a class method with the same name."
On Rails 4.1 "scope" raises on "dangerous" name conflicts: https://github.com/rails/rails/commit/7e8e91c439c1a877f867cd7ba634f7297ccef04b
Commits (1)
-
It was raising the error "You tried to define a scope named "like_search" on the model "SoftwareInfo", but Active Record already defined a class method with the same name." On Rails 4.1 "scope" raises on "dangerous" name conflicts: https://github.com/rails/rails/commit/7e8e91c439c1a877f867cd7ba634f7297ccef04b
-
I think the right fix in this case is to rename the scope, and not turn it into a class method. when you chain scopes you get a single SQL query at the end, that's not always the case with class methods.
-
Vou fechar esse MR. Essa solução (não ideal) foi aplicada em outro commit: 6f2cc74ea7def2454531baebab64f1a4127150f9
No futuro, para melhoria do desempenho, pode ser feita a refatoração com a solução ideal.
-
Status changed to closed