Ask A Question

Notifications

You’re not receiving notifications from this thread.

Restricting Javascript Widgets to Registered Sites Discussion

In this example you first render the javascript and make another call to API via fetch and check the domain in API controller. Is there a specific reason for that?

Isn't it better to check the domain at embeds-controller and if domain is not registered, we will not have to render any javascript on client side.

We can get the domain by checking headers with something like URI.parse( request.env["HTTP_REFERER"])

Reply

I'm getting a NoMethodError (undefined method `sites' for nil:NilClass) error from the part at 18:37, any suggestions?

Reply

Sites is scoped to current_user, so you need to log in first.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.