Answer the question
In order to leave comments, you need to log in
Why doesn't js.erb file run on subdomain?
I made a modal window in the form of a partial, i.e. got two files like "_modal.html.haml" and "modal.js.erb". On all pages without a subdomain, the JS code works, but not on any subdomain, although I see in the logs that everything was rendered in the same way as in the first case.
Where to look for a problem?
Answer the question
In order to leave comments, you need to log in
Method 1 (CSRF danger):
config/application.rb:
config.action_dispatch.default_headers.merge!({
'Access-Control-Allow-Origin' => '*',
'Access-Control-Request-Method' => '*'
})
constraints(Subdomain) do
post 'action_second/create', to: 'controller#create'
end
constraints :subdomain => '' do
post 'action_first/create', to: 'controller#create'
end
class Subdomain
def self.matches?(request)
request.subdomain.present?
end
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question