0

When trying to make a custom page in active_admin in a rails api-only app, I get the following:

$ is not defined 

I moved jquery.js into my /assets folder and imported it in my active_admin.js.coffee by adding the following line:

#= require jquery

but when I load my custom partial I get the js error.

My rails 5 app is api-only except for active admin which I'm customising so I do not have an application.js to import things in.

1 Answer 1

1

Check your application.rb for config.api_only. If its set to true it removes the asset pipeline. You can also check if Rails.application.assets returns nil. Basically nothing from /assets gets compiled or served.

Possible solution: https://medium.com/alturasoluciones/how-to-set-up-rails-api-app-to-use-activeadmin-79b418df8aad

The issue is that they make the API only and afterwards add everything that is removed through the config back to the app. Also read the comments in the blogpost for further insight and implications.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.