Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialfilip faber
3,078 PointsRuby in Visual Code
Hi guys,
I need some help with setting Ruby in Visual Code. I have installed ruby and ruby on rails extensions but can't launch an app. Console apps are working just fine but the project like "A Form to Edit an Existing Page" is not working. I guess some localhost setting s needs to be set. Please help me how to start and set up all settings needed to launch the app. Thank you for the help :)
4 Answers
Steve Hunter
57,712 PointsHi there,
I'm assuming you're running a Windows machine? How did you install Rails - did you use something like RailsInstaller?
In your command prompt, what do you get when you type rails -v
?
Have you created an application using rails new YourAppName
? Then navigate to the folder which will be created and run bundle install
in there. Next, try rails s
which starts your local server. Your app should be visible at http://localhost:3000
in your browser.
If the above doesn't work, I'll need more information of what your setup is; what you have created and what errors you are seeing.
Steve.
filip faber
3,078 PointsHi Steve,
thank you for the answer. Of course, I am running a Windows machine. I have installed ruby on rails just now, version 5.1.3(before I had just installed ruby and rails extensions in Visual Code). After doing this I have created a new project and navigate to the created folder to run bundle install in there. Running command rails s shows error. I am missing one of the gems(details below).
Could not find gem 'puma (~> 3.7) x86-mingw32' in any of the gem sources listed in your Gemfile.
I did try to install the missing gem but without any success. Also, I tried with commands gem install bundler and bundle install. I guess new version of rails is making a little mess. Please help me to resolve this problem. I Appreciate your help.
Filip
Steve Hunter
57,712 PointsI've found Rails 5 to be seamless. I'm not familiar with Visual Code - could this be the source of the problem?
I strongly recommend trying RailsInstaller on a Windows machine. If I were you, I would uninstall everything you've done and try the RailsInstaller package - it works. Rails and Windows are unhappy bedfellows; I use a Mac but have had no problems with the RailsInstaller environment.
What error do you get with rails s
?
Try it - see what happens.
Steve.
filip faber
3,078 PointsI have reinstalled RubyOnRails again using the link you gave, and it works now :) I have launched the local server and it works. There is only a little problem with showing the pages. When I type in address bar http://localhost:3000/vjezba1/views/welcome.erb I see only the code instead of the page what User should see. Do you have any clue, what to do?
Steve Hunter
57,712 PointsYou see the code?! How odd - that view is formatted badly. Maybe change the file name to welcome.html.erb
. I'd suggest pushing your code to Github so I can pull it down and replicate your issue. There's a workshop for that and it's well worth knowing!
filip faber
3,078 PointsHi Steve,
after researching the problem, I have found some settings to set on http://api.rubyonrails.org/. The main reason why I had code seen is missing node.js. After installation, everything works just fine. Thanks for given help and link.