Chris is a genius when it comes to programming.. it's all Greek to me.. how do you understand it all.. You are truly in a league of your own in my opinion.. Thank you for this tutorial
@deybmen3 жыл бұрын
Just what i needed for my current project
@GorailsTV3 жыл бұрын
Love when a screencast comes out at the perfect time!
@deybmen3 жыл бұрын
@@GorailsTV thank you!
@anthonypetruzzi1583 жыл бұрын
.invert 😲 where has that been my whole life. I don't do rails anymore 😭 but I just LOVE watching your videos 💘
@defsdoor3 жыл бұрын
I really liked this video, generally but primarily for one reason. It confirmed that I was on the right track with my own dive in to stimulus and turbo. There's not a lot of information out there still and, for turbo/turbo frames especially, it's very much still a moving target.
@GorailsTV3 жыл бұрын
It sure is. Luckily it's becoming easier and easier to use and more tutorials now that we've had time to learn and use it for a few months.
@kwhandy3 жыл бұрын
dude please add more hotwire-related content this semester. you also need to update any existing content that already done with turbolinks/UJS, like button loading spinner and love/like/follow button.
@GorailsTV3 жыл бұрын
It's coming!
@jheathco2 жыл бұрын
Great work. What about when editing an address to have the list of states pull on page load based on the record's existing country?
@dabiraakinwumi8698 Жыл бұрын
hey i ran into the same issue and i solved it by getting the id of the existing record from the url params. Then calling my model from my controller e.g Address.find[:id]. Once you know what country is attached to the current address you can get the list of states and attach it to the page on page load using stimulus. Thats the basic idea
@shannonmariehauck Жыл бұрын
This is awesome! I need to figure out a slight variation: suppose there are too many countries for a form.select field. Think of millions of countries. How could it use an autocomplete search to display only matching options for the user to select. Thank you!
@GorailsTV Жыл бұрын
A Javascript library like TomSelect is handy for this. You can have it load the options via AJAX requests and also filter those results remotely.
@jayjreg2 жыл бұрын
Failed to register controller: country (controllers/country_controller) TypeError: Failed to resolve module specifier "@rails/request.js". Relative references must start with either "/", "./", or "../".
@jayjreg2 жыл бұрын
Could not find a declaration file for module '@rails/request.js'.
@jayjreg2 жыл бұрын
Error invoking action "change->select#change"
@grahambinho2 жыл бұрын
Great video. Do you have a tutorial video on 'collection_check_boxes'?
@BorisBarroso2 жыл бұрын
This is nice, how it would work if you set the value of the country in the form? I think we should make changes to the *change* function to make it work
@cmthimmaiah Жыл бұрын
Awesome video, thank you
@elissonmichael28073 жыл бұрын
Thanks for sharing.
@angeluray9211 Жыл бұрын
How could I integrate this functionality with the registration form of devise, I want to let my users select the country they're from or live.
@SEOng-gs7lj2 жыл бұрын
possible to show the turbo progress bar when the request.js GET is slow?
@RohanDaxini2 жыл бұрын
Thanks for this tutorial Chris. Very helpful. Somehow just for my setup (Rails 7.0.1 and Ruby 3.0.0) the request.js didn't work for me directly while using it in country_controller.js (or select_controller.js). In other words, despite doing that step, and then calling get() function, it was unable to do anything. Though, I followed the exact step from this tutorial i.e. using "yarn add @rails/request.js". So I had to still install request.js using gem "requestjs-rails" and then running "rails requestjs:install". The earlier yarn step also added dependency in package.json but still, it was not working. After using gem and installing request.js step with rails command, it added the import statement for "rails/request.js" in import application.js. Everything worked fine after this step. It's strange but that's how it worked for me. Letting you know here just in case it helps anybody else facing the same issue.
@amazingcake70232 жыл бұрын
Did you import the " { get } from '@rails/request.js' ". I've the same setup as you and mine is not working.
@amazingcake70232 жыл бұрын
i still get this error message "Uncaught TypeError: Failed to resolve module specifier "rails/request.js". Relative references must start with either "/", "./", or "../". "
@RohanDaxini2 жыл бұрын
@@amazingcake7023 Yes I have "import { get } from "@rails/request.js"" in country_controller.js as well otherwise it wasn't working.
@RohanDaxini2 жыл бұрын
@@amazingcake7023 did you try importing i.e. import "@rails/request.js" in your application.js ?
@igorpenkovsky32093 жыл бұрын
Nice, thanks!
@kristianpapadakis996 Жыл бұрын
How would you extend this to also select a city from a given state?
@GorailsTV Жыл бұрын
You'd do the same thing when the state changes and load a list of cities from the Rails app.
@kristianpapadakis996 Жыл бұрын
Thank you, Chris@@GorailsTV
@Kami842 жыл бұрын
I need to do this for state and county within the US. As in user selects state and the second drop down will list counties within that state. There is not gem for this that I have found. How would I do this if there is no gem that I can use? I am also new to ruby on rails.
@GorailsTV2 жыл бұрын
You could load a CSV or make a database model for the counties. Doesn't really matter where you store the data. 👍
@mutigersuaheli84443 жыл бұрын
Hello, can you tell me how I can fill a simple text field dynamically in this way?
@GorailsTV3 жыл бұрын
Your turbo stream would probably need to replace the text field with one that's filled out.
@whyimustusemyrealname38013 жыл бұрын
anyone have example for typeahead combobox ?
@bristinachristian13663 жыл бұрын
Make video on pagination without gem with dropdown filter
@samuelfaure43322 жыл бұрын
Very good tutorial, but it would be amazing if you showed some tests too (with rspec/capybara for example)
@MichalDudkiewicz-m7g Жыл бұрын
he do something but source to download is build completly different
@je96253 жыл бұрын
Is it me or is the code complex ?
@GorailsTV3 жыл бұрын
It takes some getting used to. I found turbo confusing for a while.
@spryffee-old Жыл бұрын
This approach does not work if you have another controller (e.g. slim-select) set for the select fields
@GorailsTV Жыл бұрын
You would modify it to update slim select options instead.