Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

DRYed action appending in routes #3

Merged
merged 0 commits into from

3 participants

@deepakprasanna

No description provided.

lib/objectify/rails/controller.rb
@@ -23,14 +23,10 @@ def injector
def request_resolver
klass = Objectify::NamedValueResolverLocator
@request_resolver ||= klass.new.tap do |resolver|
- resolver.add(:controller, self)
- resolver.add(:params, params)
- resolver.add(:session, session)
- resolver.add(:cookies, cookies)
- resolver.add(:request, request)
- resolver.add(:response, response)
- resolver.add(:flash, flash)
- resolver.add(:renderer, Renderer.new(self))
+ {:controller => self, :params => params, :session => session, :cookies => cookies, :request => request,
+ :response => response, :flash => flash, :renderer => Renderer.new(self) }.each do |key, value|
+ resolver.add(key, value)
+ end
end

This is taking DRY too far IMO. This part is more maintainable (easier to read and modify) before this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jamesgolick

I merged the first commit, but I agree with @dchelimsky. If you want to break the second commit up, I'll accept the other part of it. Thanks!

@deepakprasanna

@dchelimsky Yeah, I agree.

@jamesgolick Please close this pull request. I ll breakup the second commit and open a new one. Thanks.

@deepakprasanna deepakprasanna merged commit 5d0c627 into FetLife:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 0 additions and 0 deletions.
Something went wrong with that request. Please try again.