Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default_url_options as a configuration requirement #60

Open
mikekelly opened this issue Nov 28, 2013 · 13 comments
Open

default_url_options as a configuration requirement #60

mikekelly opened this issue Nov 28, 2013 · 13 comments

Comments

@mikekelly
Copy link
Contributor

@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! 😢

@apotonick
Copy link
Member

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?

@mikekelly
Copy link
Contributor Author

Sorry yeah the roar readme
On 28 Nov 2013 22:25, "Nick Sutterer" notifications@github.com 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//issues/60#issuecomment-29487604
.

@apotonick
Copy link
Member

Rewriting it, with first-level HAL chapter. Do you want me to put a photo of you (top-less?) into it? 😬

@apotonick
Copy link
Member

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

?

@mikekelly
Copy link
Contributor Author

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" notifications@github.com wrote:

Rewriting it, with first-level HAL chapter. Do you want me to put a photo
of you (top-less?) into it? [image: 😬]


Reply to this email directly or view it on GitHubhttps://github.com//issues/60#issuecomment-29487692
.

@mikekelly
Copy link
Contributor Author

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" notifications@github.com 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//issues/60#issuecomment-29487857
.

@apotonick
Copy link
Member

Can you paste a raise Rails.application.config.action_controller.default_url_options.inspect in your running app?

@mikekelly
Copy link
Contributor Author

Not connected to the matrix right now but will try and remember tomorrow
morning
On 28 Nov 2013 22:46, "Nick Sutterer" notifications@github.com 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//issues/60#issuecomment-29488161
.

@apotonick
Copy link
Member

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....?

@jmartelletti
Copy link

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 ❤️

@andresf
Copy link

andresf commented Nov 29, 2013

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).

@apotonick
Copy link
Member

@mikekelly Put a huge chapter about HAL into the README, retweet appreciated!

@apotonick
Copy link
Member

And I still need to know your Rails.application.config.action_controller.default_url_options is in order to proceed with this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants