refactoring in RailsResource