The Refactoring I mentioned yesterday that I wanted to refactor the ternary operation in the ldap_con#search call so today I used extract method to pull it out. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # app/models/auth_source_ldap.rb class AuthSourceLdap self.base_dn, :filter => object_filter …
Tag: refactoring
Daily Refactor #19: Cleanup in AuthSourceLdap#authenticate
With the help of Nate Sutton I’ve done two small refactorings to AuthSourceLdap#authenticate and #authenticate_dn. The Refactoring – One This refactoring moved the check for an empty DN into the #authenticate_dn method. It makes sense to have all of the business logic and data validations for authenticating in one method. Before 1 2 3 4 …
Daily Refactor #18: Extract method in AuthSourceLdap
The Refactoring AuthSourceLdap#authenticate still can use some more refactoring. I performed another extract method, this time to create a method to authenticate an DN (Distinguished Name). Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 # app/models/auth_source_ldap.rb class AuthSourceLdap self.base_dn, :filter …
Daily Refactor #17: Extract method in AuthSourceLdap
Since I’ve been doing a lot of work on a Redmine plugin to add more LDAP features, I decided to use today to refactor some of Redmine’s LDAP code. The Refactoring I just performed a simple extract method refactoring on the authenticate method in AuthSourceLdap to make it easier to understand what it does with …
Daily Refactor #16: Rename method in RolesController
The Refactoring I’m continuing last Friday’s refactor today, but this time renaming the method in RolesController. Before 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # app/controllers/roles_controller.rb class RolesController :post, :only => [ :destroy, :move ], :redirect_to => { :action => :list } def index list …