         end
       end
 
-      scope resource.member do
-        unquote(context)
-      end
+      unquote(scope)
     end
   end
 

      defp match(var!(conn), unquote(route.verb), unquote(route.path_segments),
                 unquote(route.host_segments)) do
        unquote(Route.maybe_merge(:private, route.private))

        var!(conn) =
          update_in(var!(conn).params, &Map.merge(&1, unquote(parts)))
          |> Plug.Conn.put_private(:phoenix_pipelines, unquote(route.pipe_through))
          |> Plug.Conn.put_private(:phoenix_route, fn conn ->
              opts = unquote(route.controller).init(unquote(route.action))
              unquote(route.controller).call(conn, opts)
             end)

        unquote(route.pipe_segments)
      end
    end

  end

  defp add_resources(path, controller, options, do: context) do
    scope =
      if context do
        quote do
          scope resource.member, do: unquote(context)
        end
      end

    quote do
      resource = Resource.build(unquote(path), unquote(controller), unquote(options))

