• Ruby on Rails
    22 replies, posted
How hard would it be to learn Ruby on Rails after doing PHP for a few years? So after begin o facepunch for quite some time, everyone is telling PHP to fuck itself and use RoR instead. So and where would I go around and find a guide for doing so?
This will hold your hand from setup to working app: [url]http://ruby.railstutorial.org/ruby-on-rails-tutorial-book[/url] There's going to be a little bit of a learning curve, but I don't think it's anything incredibly large if you're already familiar with MVC. Most stuff is fairly straight forward, and there's tons of info out there. One thing I will recommend if you start playing with Rails and you like it is picking up a book on Ruby and learning Ruby well too, a lot of people jump in to rails without much background Ruby knowledge, and while you can get by by doing that, you'll be a lot better off if you have a stronger understanding of Ruby itself.
I've been trying to start learning Ruby on Rails for about a week now. I haven't gotten too far: I can't get the damn thing working on Windows. It always finds some weird errors I can't fix: Open SSL (certificate errors), JSON needing JavaScript runtime, bundle installs failing, .gemrc permissions problem, ExecJS runtime unavailable. Would I just have to create a linux virtual machine and install it on that?
[QUOTE=KmartSqrl;36608840]This will hold your hand from setup to working app: [url]http://ruby.railstutorial.org/ruby-on-rails-tutorial-book[/url] There's going to be a little bit of a learning curve, but I don't think it's anything incredibly large if you're already familiar with MVC. Most stuff is fairly straight forward, and there's tons of info out there. One thing I will recommend if you start playing with Rails and you like it is picking up a book on Ruby and learning Ruby well too, a lot of people jump in to rails without much background Ruby knowledge, and while you can get by by doing that, you'll be a lot better off if you have a stronger understanding of Ruby itself.[/QUOTE] I will see if I can find a Ruby book somewhere. And read those. Thanks man! [QUOTE=Chesnut;36608961]I've been trying to start learning Ruby on Rails for about a week now. I haven't gotten too far: I can't get the damn thing working on Windows. It always finds some weird errors I can't fix: Open SSL (certificate errors), JSON needing JavaScript runtime, bundle installs failing, .gemrc permissions problem, ExecJS runtime unavailable. Would I just have to create a linux virtual machine and install it on that?[/QUOTE] I've got a dedicated server at home, with Ubuntu Server 12.10 on it. Won't be a problem, and won't be using windows.(Except for development) [editline]3rd July 2012[/editline] "A ruby book".."OR TWO" * stupid mistakes
I have this one at home: [url]http://nostarch.com/ruby[/url] This looks pretty good from a quick glance too: [url]http://www.ruby-doc.org/docs/ProgrammingRuby/[/url] [editline]3rd July 2012[/editline] And while you can get ruby working on windows I'd definitely recommend working on something UNIX based, it is just a smoother experience.
[QUOTE=Chesnut;36608961]I've been trying to start learning Ruby on Rails for about a week now. I haven't gotten too far: I can't get the damn thing working on Windows. It always finds some weird errors I can't fix: Open SSL (certificate errors), JSON needing JavaScript runtime, bundle installs failing, .gemrc permissions problem, ExecJS runtime unavailable. Would I just have to create a linux virtual machine and install it on that?[/QUOTE] Can you post a backtrace? Maybe we could help you out. That said, Rails on Windows is generally a PITA
[QUOTE=swift and shift;36616421]Can you post a backtrace? Maybe we could help you out. That said, Rails on Windows is generally a PITA[/QUOTE] Well, I've fixed the majority of the errors, but I can't get it to generate a controller. [CODE] C:\Windows\System32>cd C:\Sites\Tramvai C:\Sites\Tramvai>rails generate controller testcontroller index Failed to load C:/Users/Tramvai/.gemrc due to permissions problem. C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l ib/mysql2/mysql2.rb:2:in `require': 193: %1 is not a valid Win32 application. - C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32 /lib/mysql2/1.9/mysql2.so (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:68:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:68:in `block (2 levels) in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:66:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:66:in `block in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:55:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:55:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler.rb:122:in `require' from C:/Sites/Tramvai/config/application.rb:7:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:24:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:24:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'[/CODE]
[QUOTE=Chesnut;36608961]Would I just have to create a linux virtual machine and install it on that?[/QUOTE] This would be the best option.
[QUOTE=Chesnut;36617579]Well, I've fixed the majority of the errors, but I can't get it to generate a controller. [CODE] C:\Windows\System32>cd C:\Sites\Tramvai C:\Sites\Tramvai>rails generate controller testcontroller index Failed to load C:/Users/Tramvai/.gemrc due to permissions problem. C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l ib/mysql2/mysql2.rb:2:in `require': 193: %1 is not a valid Win32 application. - C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32 /lib/mysql2/1.9/mysql2.so (LoadError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:68:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:68:in `block (2 levels) in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:66:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:66:in `block in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:55:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:55:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler.rb:122:in `require' from C:/Sites/Tramvai/config/application.rb:7:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:24:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:24:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'[/CODE][/QUOTE] do you have anything in your .gemrc?
[QUOTE=swift and shift;36618664]do you have anything in your .gemrc?[/QUOTE] The file doesn't exist. Progress. Onto another error: [CODE] C:\Windows\System32>cd C:\Sites\Tramvai C:\Sites\Tramvai>rails generate controller testcontroller index Failed to load C:/Users/name/.gemrc due to permissions problem. C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/run times.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://gi thub.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUn available) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/l ib/execjs.rb:5:in `<module:ExecJS>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/l ib/execjs.rb:4:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-script- 2.2.0/lib/coffee_script.rb:1:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-script- 2.2.0/lib/coffee_script.rb:1:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-script- 2.2.0/lib/coffee-script.rb:1:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-script- 2.2.0/lib/coffee-script.rb:1:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-rails-3 .2.2/lib/coffee-rails.rb:1:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/coffee-rails-3 .2.2/lib/coffee-rails.rb:1:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:68:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:68:in `block (2 levels) in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:66:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:66:in `block in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:55:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler/runtime.rb:55:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22 /lib/bundler.rb:122:in `require' from C:/Sites/Tramvai/config/application.rb:7:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:24:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 /lib/rails/commands.rb:24:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'[/CODE] I have the ExecJS gem (1.4.0).
You still need a JS runtime. However, it should find Windows Script Host (cscript).
Honestly if i was you i would just dual boot ubuntu or some other distro, Every time i've tried to develop rails or ruby projects in windows everything breaks for what appears to be no reason at all, it's all trial and error finding the right version of ruby to run with the version of rails you want to use. With Ubuntu, all i did was install RVM, which pretty much did everything for me and allows me to switch between different versions of rails and ruby for different projects. It was just so much easier and Linux environments seem a lot better for developing rails as far as productivity is concerned. If you use gnome, gedit with the right plugins works fairly well for developing rails apps. KDE i haven't really used so i can't suggest a good text editor or ide to use. From what i understand OSX is really nice to develop rails apps in as well and has text-mate available for it, which in most of the tutorials you'll see the developers are using.
I made a virtual machine and ran this pre-made Ubuntu with Ruby on Rails on it: [url=http://www.turnkeylinux.org/rails]Turnkey Linux: Rails[/url]. The package includes MySQL, Ruby, RubyGems and lots of pre-installed gems. It allows me to access the command line using the browser on Windows. I also made Sublime Text 2 sync the files with the RoR server using FTP. This is how I solved all the issues.
[QUOTE=Chesnut;36676053]I made a virtual machine and ran this pre-made Ubuntu with Ruby on Rails on it: [url=http://www.turnkeylinux.org/rails]Turnkey Linux: Rails[/url]. The package includes MySQL, Ruby, RubyGems and lots of pre-installed gems. It allows me to access the command line using the browser on Windows. I also made Sublime Text 2 sync the files with the RoR server using FTP. This is how I solved all the issues.[/QUOTE] ughghgughh ruby 1.8
[QUOTE=swift and shift;36676213]ughghgughh ruby 1.8[/QUOTE] Something wrong with that solution as well? D: Tell me how, tell me! I'm about to give up on Ruby on Rails because it takes way too much effort to get it working properly.
Set up your own virtual machine and install Ruby 1.9.x yourself. You'll have to end up learning how to in the end anyway.
Ruby 1.8 handles things in different ways than Ruby 1.9, my suggestion is to use RVM if you're on linux, or perhaps RubyInstaller if you're on windows. Ruby really isn't too difficult to install
Plus, 1.8 is shit out of date and support ran out on the first of this month.
[QUOTE=Chesnut;36677117]Tell me how, tell me! I'm about to give up on Ruby on Rails because it takes way too much effort to get it working properly.[/QUOTE] % curl -L [url]https://get.rvm.io[/url] | bash -s stable reload your shell session % rvm install 1.9.3 % gem install rails done
Seriously, just dual boot ubuntu, 10.10 or any later LTS and it will work just fine, and install ruby using RVM... Then all you have to do is install rails using "gem install rails" it's way easier then mucking with it in windows and you'll have a lot more success. I'm running it with 12.04lts with no issues at all. Also if you want a good tutorial use [URL]http://ruby.railstutorial.org/[/URL]
And whatever you do, [b][i]whatever[/i][/b] you do, don't ever install Ruby from the system package manager
Hey, I can definitively recommend the [url]http://ruby.railstutorial.org/[/url] Screencast series. For some people the price might seem high, but the book in combination with the screen-cast series will definitively teach you a LOT. I've been running RoR on Windows without any Problem, except that the Sublime RubyTest Plugin doesn't work properly. Not a big deal as you can just have a cmd window open with bundle exec rspec.
I know this thread is a month old, but [URL="http://railsforzombies.org/"]Rails for Zombies[/URL] is an excellent place to start, if anyone still needs it. Mainly because it has tests after every video that require you to make sure you fully understand what was taught by typing the code to output what they want.
Sorry, you need to Log In to post a reply to this thread.