Hacker News new | comments | ask | show | jobs | submit login
Help with Rails?
31 points by jrbeal on July 14, 2013 | hide | past | web | favorite | 52 comments
This is my first post and I hope it's appropriate for the site. My son admires HN and recommended I ask for help here. I'm an "old" CS guy (graduated back in the 80's) and have NOT kept my skills up-to-date as my career led me from development to mostly sysad stuff. So for the last few years, I've had this web site idea and spent the last year designing it while trying to learn Ruby on Rails (using Mark Hartl's tutorial). Setting up a Linux VDI and getting the environment right is driving me crazy. It's always one problem after another. I'm normally a very persistant guy but Hartl's recommended problem solving algorithm (google it) doesn't always work. I'm at the point where I'll do anything just to get this project off the ground. Any ideas or suggestions? I'd pay someone to help me but I don't know where to find such a person.



Wow! My son was right! This site is awesome! Thanks SO much everyone! Good question wintermute. I wanted a Linux development environment but only have Windows at home. I was thinking about buying another box just for this purpose and load native Linux thinking this would be less ghetto but I don't know...

Thanks for the offer benigeri! I'll hit you up later...

thinkful.com sounds like a great resource.

shail: There were way too many problems to list here. Basically, the pattern I was falling into was as follows: I'd start a new project, start setting everything up, run into problems, fix them, run into more problems, fix them, etc... I'd have problems with everything from running bundle successfully, to deploying successfully. Then I'd get to the point where nothing would work and I'd eventually start over. Very frustrating.

The suggestions here are giving me hope and renewed enthusiasm. I'll check back later...


I would suggest running Linux in a virtual machine. A decent choice would be the combination of Ubuntu running under VirtualBox (a free VM). Here's a random guide I found online (I'm not vouching for its veracity): http://www.psychocats.net/ubuntu/virtualbox

I bet it's possible to do all this stuff under Windows natively too, but it's probably going to be harder to find help. So if you have some familiarity with UNIX-like OSes already, I'd suggest just using something like Ubuntu in a VM.


Jey, I've tried to avoid installing Ruby and Rails on Windows because of all the horror stories out there. I had no problem installing VirtualBox and creating a Linux Mint VDI. In fact, I've worked with UNIX for the last 25+ years so I'm actually more comfortable with it (or Linux) than Windows. My problems are with Ruby and Rails and all the associated gems, getting the Gemfile right, understanding what the hell I'm doing with Github (git commit this, git commit that, etc.) And then running the server only to get a bunch of screwy errors that make no sense. But thanks to all the support in this thread, I'm sure I'll make headway soon. Thanks!


Unfortunately, developing for rails in windows today is a bag of hurt, so you'll probably need to learn some basic linux skills. I'd suggest, if your time and hardware allows, to spend some time in a virtual machine using one of the more popular linux distributions to get a hold of what's going on. Besides, there is a LOT of guides and tutorials of how to set up the development environment for ubuntu or debian.

Anyways, keep going, pain is temporary :)

Off topic: there is a small and hard to notice "reply" link below every comment.


Thanks xentronium, I probably wasn't clear on this but my linux skills are okay (been woring in Unix for 25+years). I set up a VDI with Linux Mint which seems okay... Thanks for the encouragement! (and the tip on the "reply" button -- haha)


There's a really long way from getting bundle to run until you need to deploy. I'd recommend not worrying about deployment until you've got your app up and running locally.

If you want to develop on Linux without buying another machine, you could (at least for now) download VirtualBox and install Linux on it. That will let you run Linux from within Windows.


My son said the same thing. I guess my concern was getting all the way to the deployment stage only to realize there was something I should have been doing differently way too late in the game... (I'm probably being paranoid!) Anyhow, so you recommend that I press with the development and NOT worry about deploying (to Heroko -- or whatever) until much later... I can live with that! (Just run the rails server and connect with browser at port 3000... right?


Honestly, yeah.. deploying to Heroku is ridiculously simple for simple apps, and from the sounds of it I would expect that you don't have a hundred moving pieces in it yet (and may never). Deploying to something else, like AWS, is more involved but still it's most likely not going to be much different in the end than it is in the beginning.


You might want to check out vagrant to set up your development environment under windows.

http://www.vagrantup.com/


I'll look into it... This sounds like it could be exactly what I need! Thanks!


Oh, boy. I've gotten our rails dev environment set up on a dozen different machines now and there's always a little problem here or there. One thing I can say right off the bat: I could never get it fully up and running on Windows, unfortunately.

But we have had success on both OS X and Linux machines.

The trick is to 1) install rbenv or rvm, 2) build the right version of ruby, 3) install the right gems, 4) make sure your PATH is set up properly.

The rails consultancy thoughtbot has a script you can run to just magically set up a new laptop for rails development. I don't do this (too magical, and too little control), but I usually pull up the script[1] just to remind myself of what things I need to attend to and install.

Feel free to hit me up at my email address in my profile if you're stumped on something. I've probably seen most issues by now...

[1] https://raw.github.com/thoughtbot/laptop/master/linux


I know you're not on a mac, but I just re-setup a mac and went through this. So, for anyone wondering. Luckily with homebrew supporting rbenv now it's a lot easier to do.

Download the git installer and run it.

Install homebrew using their script.

brew install rbenv

brew install ruby-build

Once that is done you'll need to copy some stuff in your shell profile. It will tell you the two lines. Restart your shell.

Here's the first trick. You need openssl:

brew install open-ssl

(make sure "qmake" is now available or restart shell and see)

To see ruby versions: rbenv install -l

I installed 2.0.0-rc2: rbenv install 2.0.0-rc2

Almost there! Set it as your global ruby

rbenv global 2.0.0-rc2

Make sure this outputs the right ruby version now: ruby -v

Now install bundler and rails!

gem install bundler

gem install rails

I probably missed a step or two, but I just ran through that process and had a few bumps in the road as usual myself.


Correct me if I'm missing something, but why exactly are you using 2.0.0-rc2, when there is 2.0.0-p247 available?

I'd suggest doing

    rbenv install 2.0.0-p247

    rbenv global 2.0.0-p247
Also, it's openssl, not open-ssl, (just in case someone couldn't complete the step) i.e.

    brew install openssl


Don't worry, it's like this for everybody. Just hang in there. Suddenly it'll all come together and you'll forget what was so hard about it.


Can't wait for that "aha" moment when everything starts making sense! Until now, It's been pretty much me and google. I'm very encouraged by the support from everyone on this site. Thanks you very much!


1. Use Heroku or Engine Yard 2. Start with a hello world and build from there one feature at a time 3. When you get stuck, use Stack Overflow or other Ruby on Rails forums for help as opposed to HN, we're not a terribly good source.

Good luck :)


I started learning Rails this summer too! Chapter 1 (the set up) was very annoying, like he warns. StackOverflow is great though! People often answer your questions within minutes (if you word them well and put thought into them). That's the best advice I've got for chapter 1. It's something that is going to be annoying.

I'd recommend going through his tutorial rather briefly first. Like a skim. Then read through http://guides.rubyonrails.org/. Then go through is tutorial one more time. Then try building your website, while using Railscasts and StackOverflow for help.

See http://fast-reaches-9399.herokuapp.com/how-to-learn-to-progr... for more information. Good luck!


you could try vagrant, not sure if its the VDI that you were referring to, but I would say that setup generally seems smoother inside of linux vs. other environments (so it's worth it to deal with the extra complexity of a vm)

there are a bunch of github projects that you can get that has everything to setup a VDI- this one seems popular: https://github.com/amaia/rails-starter-box

there's also a railscast about it: http://railscasts.com/episodes/292-virtual-machines-with-vag...


Why do you need a Linux VDI? Test locally with the Rails server, then deploy to Heroku.


So.. You're half right IMHO!

A linux desktop is entirely unnecessary. But so is Heroku.

This "just deploy to Heroku" mentality is really starting to get on my nerves.

Heroku is a great product that solves real problems for a certain class of project (and user). It is not, in any way, shape or form, the solution to every problem. Stop telling people it is.


Deploying someone's first RoR project seems like exactly the class of project and user that Heroku is a good fit for.


you can't argue with their free tier.

if you need to get a rails app hosted NOW, it's as simple as

    heroku create appname
    git push heroku master


Yes, if you're runnign rails, you definitely shd learn the first 10 minutes of a wide open VPS config (passwd,ssh, fial2ban, iptables/ufw etc)... sometime But it doesn't have to be the first deploy


Don't "need" a Linux VDI but I have to install Ruby and Rails somewhere. Linux (Mint) seemed like a logical choice. Most people recommend NOT installing to Windows. Like I said earlier, I'd be down with buying a separate box just for this purpose (and future projects) with Linux installed natively if you guys thought that would gain me an advantage. I have a Heroku account and might deploy there initially but also have a Bluehost account that I intend to use eventually.


I highly recommend Action.io - a cloud-based linux development environment and IDE that I wish were around when I got started. I literally created a new box, cloned a rails app from github, raked the db and fired up rails server in less than three minutes.

Really, check it out if you're having difficulty getting your environment set up. Here's a link to get started https://www.nitrous.io/join/BiSdgSxLjIk (full disclosure: it's a referral link that will get me No2 credits).

And when you're ready to deploy, just use Heroku. Good luck and keep at it!


1. Get on IRC, people hang out there all day waiting to help people for free.

2. Here's a volunteer hotline to call for help: http://rails.pockethotline.com/


And then stay on IRC - and try and help other people with their problems as a displacement activity while you're letting your subconscious work on something else.

Not only will you learn things by trying to help, but you'll demonstrate value as a community member which will improve the quality of the help you receive as well.


Understood!


I'm so glad I posted this question... I had no idea this hotline existed. Already bookmarked. I'll definitely kick in a few bucks!


Hey jrbeal, I've had the same problems. I taught myself ROR over the past year and I had huge issues getting it off the ground. I've been through over 20 different sets of tutorials, so I'm sure I can help out.

I also had a lot of initial difficulty setting up my environments, but I've gotten a lot better at it now.

If you'd like, send me an email benigeri@stanford.edu and I can try to help you and point you to good resources. It's a little hard to suggest anything right now since I don't have any context.

So send me an email and I'll try to help you as much as I can, pro-bono.


Are there ruby or rails user groups/meetups around you? If not, there's a bunch of mentor groups, or reddit seems pretty supportive. Stackoverflow is pretty good but there aren't enought people answering questions for the volume they're getting

http://www.railsmentors.org/

https://github.com/rails-oceania/roro/wiki/Available-mentors

http://www.reddit.com/r/rails/

http://installfest.railsbridge.org/installfest/ (Railsbridge is a fantastic organization, if you emailed i bet they would help

I've been going thru same thing, my MBP hard drive died, so i installed RVM, bundler, and rails 3.2 on a couple ubuntu 12.04 laptops while i'm waiting for my Snow leopard install DVD. The key insight is to write down every step if you have to back out. And read 2 or 3 blogs and see what they agree on before starting install. These are good for 12.04

http://excid3.com/blog/setting-up-ubuntu-12-04-with-ruby-1-9...

http://footyntech.wordpress.com/2012/09/19/installing-ruby-r...


Coming from a Windows-only background you'll find it's probably a much smoother experience while developing on a Linux desktop or in Mac OS X.

Installing a nice Ubuntu 13.04 desktop is not complex, there a video which explains installing Virtualbox and Ubuntu under ten minutes: http://www.youtube.com/watch?v=0WiiswmOH1Q ... note that a desktop is not required but given your background you would feel more comfortable having a desktop, graphical text editor (eg. gEdit or Sublime Text) and one or more terminals to run the commands.

Another option would be to install Cygwin, an Unix-like environment for Windows: http://www.youtube.com/watch?v=WRB9t2tSsjY and continue the tutorial from there.

Honestly, I think that if you have sysadmin skills, it's likely you'll have some Unix exposure, and if you don't have yet, learning Ubuntu and Linux will be a benefit on the long run.


Try Linux Mint instead...

Its Ubuntu under the hood, but has a windows like UI.

I almost gave up on Rails because I was using windows; life is easier as a rails developer with Linux or a Mac.



This thread turned out to be a great source of information right when I needed it! Thanks, everyone!

However, I'm just starting to work on a webapp for a client (learning from scratch, this is my first big project in Rails), and I was wondering which version to start with. Since I'm starting with no pre-existing codebase, it's very tempting to go with Rails 4.0 as opposed to 3.2, but I'm afraid not all essential gems support it yet. Also, there probably isn't as much information for bugs and problems etc.

Any advice would be greatly appreciated!


Michael is very responsive to questions although you should first use his debugging tips. He'll usually fix your problem with one line of code.

http://ruby.railstutorial.org/help

If you don't find your answer from either the debugging tips or a Google search, try writing your question on StackOverflow. Most of the issues you face are probably solvable by knowing what line of your error to search for.


I've always found it's a lot easier if you learn the language (And others' habits & conventions) before picking up the framework. Rails will come a lot easier after you're familiar with Ruby and getting the correct environment setup (RVM/RBEnv, Familiarity with popular libraries, etc)

Best of luck!


Maybe I can help! http://askabootstrapper.com


I stumbled across thinkful recently: http://www.thinkful.com and I think having a mentor while learning to code (especially web dev) is really helpful.

PS: I have not used thinkful before.


My tip: DON'T USE RVM. (rbenv is a good alternative)

RVM is the nÂș1 source of problem in Ruby envs.


RVM is not that terrible. If your biggest difficulty in Ruby or Rails is RVM, you haven't been around long.

The cause of problems for beginners is quite simply "change". Rails has been through a few major revisions now, and the jump from 2 to 3 dropped a lot of people (even though 3.1.x+ has been fine), and I doubt many will drop again from 3 to 4, even though there are some big changes. The problem is that with all of the changes comes a bunch of now inaccurate information that no one will update that is found easily, some with high point rankings in S.O.

The more important problem to fix though is leadership. DHH has done a great job, but either he or someone else needs to be more vocal as a single voice leading Rails. It is led by committee currently, and it shows in the lack of vision. However, despite its problems, I'm in it for the long haul. I like it a lot better than everything else.


I'll admit having a custom "cd" makes me really itchy, but rvm is the path of least resistance (mysql and ubuntu are the same: itchy PLR)

http://railsinstaller.org/


Seeing that rbenv's install procedure is slightly longer than RVM, I wouldn't suggest it for beginners.


I follow this guide to set up rvm, ruby, and rails: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/


Could you describe the problems you are facing in more detail?

I guess you would not have to pay to get directions. One-on-one help might need payment.


Maybe stackoverflow or serverfault could help if you are having specific issues with the code or the server setup?


Hey, I would love to help. no need of payment, just a thank you is enough. Contact me, email in profile


I love Rails, but I think it might be better for you to go with a PHP framework. PHP is just dead simple to get running and deploy. I would suggest something like Yii or Codeigniter, both of which are somewhat similar to Rails in their architecture.


That's all well and good, unless you're actually wanting to learn Rails. :)


Of course. My impression was that Rails was just a means to an end though. That said, learning Rails would probably be a lot easier after first grokking a simpler php setup.


jrbeal, you can try Laravel, it's a Php Framework and you can setup everything in a couple of minutes and probably develop your idea without having to deal with all those issues.


Use node.js! It's as easy as npm install, npm start. Few other steps for the mongodb as well. None of this weird rvm crap. 90% of the time we're just putting text on the screen in various arrangements. Doesn't need to be rocket science.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: