Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

add modify in place setters for relations

#3867

While playing around with Arel I was surprised to find that there were no setters to modify a relation. In other words, "bang" methods (!) to update a relation using multiple calls. I think it would be nice if the following were possible:

users = Table[:users]

users.where!(users[:id].eq(1))

This would make it possible to use conditionals when generating a query.

I realize I can achieve a similar effect today just by storing the results of a where call into a new variable, but I think the bang methods are more elegant.

Thanks for your consideration.

Reported by Steve Erickson · February 5th, 2010 @ 09:10 PM

State: wontfix
Milestone: none
Assigned to: Pratik Pratik
Importance: Low

Activity

  1. Pratik
    Pratik
    • State changed from new to wontfix

    Most of the core team believes that it's great to have immutability and is the recommended way. So I don't see ! methods making it to the core. However, it should be simple to write a plugin for it.

    February 6th, 2010 @ 12:07 PM