Skip to content

Instantly share code, notes, and snippets.

View slamotte's full-sized avatar

Steve Lamotte slamotte

  • Manitoba, Canada
View GitHub Profile
@slamotte
slamotte / shallow_nested_routes.rb
Last active March 21, 2018 12:06
Allows ActiveResource to be used with shallow nested routes.
module ShallowNestedRoutes
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Pass in the name of the parent class
def set_shallow_nested_route_parent(parent)
parent = parent.to_s
# Override these methods so they set the prefix path before a call and reset it afterward.