rails/rails — comment on commit 8775ffa37231d381cba34f0ecacb8a7bbcf0573f
File:  line 0
By matthewrudy:

I think that's pretty dirty compared to.

``` ruby
def current_user_session
UserSession.find
end
memoize :current_user_session
```

and that's a simple example.

``` ruby
def to_params
to_hash.map do |key, value|
"#{key}=#{value}"
end.join("&")
end
memoize :to_params
```
looks ok.

But....

``` ruby
def to_params
if defined?(@to_params)
@to_params
else
@to_params = to_hash.map do |key, value|
"#{key}=#{value}"
end.join("&")
end
end
```
looks gross.

But I guess what we're really saying is that it doesn't belong in Rails.

Think I'll just put it into a memoizable gem.