Hotfix for UrlHelpers with Grape in production

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/1547/head
Alex Coles 10 years ago
parent b627889b8e
commit 4a05c2debd
  1. 2
      lib/api/v3/activities/activity_representer.rb
  2. 4
      lib/api/v3/queries/query_representer.rb
  3. 8
      lib/api/v3/users/user_representer.rb
  4. 7
      lib/api/v3/work_packages/work_package_representer.rb

@ -36,7 +36,7 @@ module API
class ActivityRepresenter < Roar::Decorator
include Roar::Representer::JSON::HAL
include Roar::Representer::Feature::Hypermedia
include Rails.application.routes.url_helpers
include OpenProject::StaticRouting::UrlHelpers
self.as_strategy = API::Utilities::CamelCasingStrategy.new

@ -36,14 +36,14 @@ module API
class QueryRepresenter < Roar::Decorator
include Roar::Representer::JSON::HAL
include Roar::Representer::Feature::Hypermedia
include Rails.application.routes.url_helpers
include OpenProject::StaticRouting::UrlHelpers
self.as_strategy = API::Utilities::CamelCasingStrategy.new
property :_type, exec_context: :decorator
link :self do
{ href: "http://localhost:3000/api/v3/queries/#{represented.query.id}", title: "#{represented.name}" }
{ href: "#{root_url}/api/v3/queries/#{represented.query.id}", title: "#{represented.name}" }
end
property :id, getter: -> (*) { query.id }, render_nil: true

@ -36,7 +36,7 @@ module API
class UserRepresenter < Roar::Decorator
include Roar::Representer::JSON::HAL
include Roar::Representer::Feature::Hypermedia
include Rails.application.routes.url_helpers
include OpenProject::StaticRouting::UrlHelpers
self.as_strategy = API::Utilities::CamelCasingStrategy.new
@ -59,12 +59,6 @@ module API
def _type
'User'
end
private
def default_url_options
ActionController::Base.default_url_options
end
end
end
end

@ -36,7 +36,7 @@ module API
class WorkPackageRepresenter < Roar::Decorator
include Roar::Representer::JSON::HAL
include Roar::Representer::Feature::Hypermedia
include Rails.application.routes.url_helpers
include OpenProject::StaticRouting::UrlHelpers
self.as_strategy = ::API::Utilities::CamelCasingStrategy.new
@ -89,11 +89,6 @@ module API
'WorkPackage'
end
private
def default_url_options
ActionController::Base.default_url_options
end
end
end
end

Loading…
Cancel
Save