roar-rails
roar-rails copied to clipboard
default_url_options as a configuration requirement
@apotonick just a quick one.. working on a new API and wondering about the reasons why the default_url_options
config option is a requirement and you weren't able to delegate this to Rails by default?
also - you dropped hal from the readme! :cry:
Sounds like a good idea to delegate that per default.
No, eh, what do you mean? Did the roar-rails README ever contain docs about HAL? Or are you talking about the roar README?
Sorry yeah the roar readme On 28 Nov 2013 22:25, "Nick Sutterer" [email protected] wrote:
Sounds like a good idea to delegate that per default.
No, eh, what do you mean? Did the roar-rails README ever contain docs about HAL? Or are you talking about the roar README?
— Reply to this email directly or view it on GitHubhttps://github.com/apotonick/roar-rails/issues/60#issuecomment-29487604 .
Rewriting it, with first-level HAL chapter. Do you want me to put a photo of you (top-less?) into it? :grimacing:
Do you mean to change this line from
Rails.application.config.representer.default_url_options or {}
to
Rails.application.config.representer.default_url_options or
Rails.application.config.action_controller.default_url_options
?
You read my mind - this is exactly why I brought this up ;)
Just checking. I brought up the README for some example usage and couldn't spot any hal examples. Sad times. But they're coming back. Yay! Good times. On 28 Nov 2013 22:28, "Nick Sutterer" [email protected] wrote:
Rewriting it, with first-level HAL chapter. Do you want me to put a photo of you (top-less?) into it? [image: :grimacing:]
— Reply to this email directly or view it on GitHubhttps://github.com/apotonick/roar-rails/issues/60#issuecomment-29487692 .
Yeah that's the sort of change I was getting at. I wondered if you had deliberately avoided this for some reason On 28 Nov 2013 22:35, "Nick Sutterer" [email protected] wrote:
Do you mean to change this linehttps://github.com/apotonick/roar-rails/blob/master/lib/roar/rails/url_methods.rb#L6from
Rails.application.config.representer.default_url_options or {}
to
Rails.application.config.representer.default_url_options or Rails.application.config.action_controller.default_url_options
?
— Reply to this email directly or view it on GitHubhttps://github.com/apotonick/roar-rails/issues/60#issuecomment-29487857 .
Can you paste a raise Rails.application.config.action_controller.default_url_options.inspect
in your running app?
Not connected to the matrix right now but will try and remember tomorrow morning On 28 Nov 2013 22:46, "Nick Sutterer" [email protected] wrote:
Can you paste a raise Rails.application.config.action_controller.default_url_options.inspect in your running app?
— Reply to this email directly or view it on GitHubhttps://github.com/apotonick/roar-rails/issues/60#issuecomment-29488161 .
The thing is, Rails.application.config.action_controller.default_url_options
is nil
in some of my apps. I just tested it. So defaulting the representer
option to the action_controller
directive wouldn't really help.
I now wonder how people actually use the Rails.application.config.representer.default_url_options
in their apps? Do you guys copy the hash from action_controller.default_url_options
or leave it blank, or....?
nil
here, I set Rails.application.config.representer.default_url_options
as per the instructions I read at the time - but only use *_path
helpers in my representers so far :heart:
We serve different APIs at different endpoints, for example:
api.host.com accounting-api.host.com sales-api.host.com
The subdomain gets set as part of the representer.default_url_options
, so that routes point to the correct controllers (there is some overlap in the resources exposed by the APIs).
We also define the host and protocol, but those aren't really significant (they don't change).
@mikekelly Put a huge chapter about HAL into the README, retweet appreciated!
And I still need to know your Rails.application.config.action_controller.default_url_options
is in order to proceed with this issue.