-
Notifications
You must be signed in to change notification settings - Fork 134
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
Installing in Rails 5 or 6? #96
Comments
@brandoniffert I saw that you are using easydropdown with webpack (from #79). Does that mean you're using Rails? Might you be able to advise? |
@gbirchmeier I haven't used Rails in awhile but have you tried requiring it and defining it in the script you are using it? const easydropdown = require('easydropdown')
const customDropdown = easydropdown('select') |
I get I'm kind of hoping some rails ninja will pop in and tell me the proper "Railsy" way to do this. Webpack's the official Rails 6 loader now, so it should be pretty mature, right? Seems like it shouldn't require any elaborate tricks to load a fricking library... |
This should get you started. |
Hi all - thanks for the constructive suggestions so far. It sounds like this may be a scoping issue:
If you are using I would recommend writing any custom or rails specific JS, directly after your |
Thanks @btrewern for helping me get past this. (The following answer is also posted to SO.) For Rails 6, here's what works for me:
Bonus help: Are you using Stimulus JS? If your dropdown is connected to a Stimulus controller, here's some tips: I found that I still had to assign Seems the most straightforward thing to do is to call
|
I apologize for submitting a help request as a Git issue, but I did not see any other place to ask.
Has anyone used this with Rails 5 or 6? I'm attempting to install it into my Rails 6 app, but I'm not able to make it work.
I've used
yarn add easydropdown
to install it, and verified that it's in my asset pipeline.I added
import easydropdown from 'easydropdown'
to app/javascripts/packs/application.js. No notable errors there.But in my page, the
easydropdown
var is not defined. I suspect I'm missing something dumb, but I'm not JS-savvy enough to know what it is.NOTE: I also threw a question up on StackOverflow.
The text was updated successfully, but these errors were encountered: