Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Kim Jong III posted:

Hi Rails people! I'm going to be picking up RoR soon for my job. Does anyone have any recommended tutorials that are focused on someone who has plenty of experience under their belt?

I'll be moving from a mostly Python/Django environment, if that helps. So I'm comfortable with MVC, ORMs, etc.

Sorry if this has been asked before. I tried to look through the thread but it's kinda massive...

The Rails 3 Way seems to be the de facto encyclopedia on rails. Its not really a tutorial but will cover everything at a fairly in-depth level since you are already familiar with MVC etc.

Adbot
ADBOT LOVES YOU

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Switzerland posted:

I hope I'm not asking too tedious a question, but for those of us who prefer books over online tutorials, what would your book suggestions be for someone who's been messing ONLY with procedural PHP (I know :( ) and wants to level up with RoR, Lucene, MongoDB, and all the other fun buzzwords?

I think its been mentioned on here before but Ruby on Rails 3 Tutorial is pretty solid. I am been meaning to get Rails 3 In Action because it looks like it takes a good end to end approach of an app just like Rails 3 Tutorial.

MrDoDo fucked around with this message at 07:13 on Aug 19, 2012

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.
Is anyone at Rubyconf?

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Knyteguy posted:

Good God installing Ruby/Rails/Phusion Passenger on a Linux cPanel server without taking over the entire virtual host was a nightmare. I feel like RVM complicated things even further.

The good news is I finally got it working http://www.pluswebhost.com/rails/ :getin:

Maybe I'll write up a tutorial for other developers who want to run it all on their own existing server. All the information is out there, but it's definitely not all in one place.

Quick question: How do I change what environment I'm working with? Rails I'm fairly certain started the configuration on production. Thanks!

Set the environment variable RAILS_ENV to whatever (development, production, etc)

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Knyteguy posted:

Thanks for the help. So would this be correct? rake RAILS_ENV=development ?

Also if anyone could lend a hand... I'm having some problems with a 500 server error. It's when I try to enter some information to the database.

Website with error:
http://www.pluswebhost.com/rails/posts (hit new post, and try to create)

Code:
https://github.com/Noppadet/RailsBasicApp

Git isn't fetching the sqlite3 files that are present on my development server but I'm guessing that's just a driver? Still really new to the ROR stuff.

Thanks :).

E:
Rails logs aren't showing anything out of the ordinary. Could it be chown rights?

You can specify the env on each command run or you can just export RAILS_ENV and every subsequent command will use that same one

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Knyteguy posted:



Path of least resistance I guess. Some people on the cPanel forums mentioned that mod_rails worked so that's what I went with.



You really should check out Heroku is all you want to do is mess around with Rails

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

kitten smoothie posted:

I think the question is what's the value of your time early on in a project. Do you want to spend time computer janitoring a server, or do you want to spend that time writing code that could make you money and deal with migration if it takes off?

I have to agree with this as well. Heroku is a really nice way to get your app in to a production environment quickly and allow you to assess the situation from there. If your traffic becomes too much, and you don't want to just pay to scale with Heroku, then just migrate it elsewhere.

MrDoDo fucked around with this message at 09:30 on Nov 16, 2012

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Physical posted:

Here is a convenience I find lacking:
Ruby code:
MyModel.where( :some_criteria => my_var)
When my_var is nil, the SQL turns into "some_criteria = 0", but I don't want that, I want 'some_criteria is NULL' do I have to do it on my own or is there something I am missing?

It seems like its how you are producing my_var. Is it being generated by some sort of count of query of its own that would return 0 instead of nil in the case of no results?

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.
Anyone here gonna be at Heroku's Waza next month?

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Hefty posted:

I'm brand new to ruby as well as rails, so I'm going through the exercises over at code academy and messing around with some very basic rails apps.
My question is, what's the best way to debug controllers (and to a lesser extent, views) when you're not trying to debug anything specifically? Just poking around seeing what the scaffolded code does, seeing what happens when you change x to z, etc. I tried installing ruby-debug, but apparently it "Can't handle 1.9.x yet". Am I pretty much stuck writing a bunch of logger.debug statements everywhere?

I'm running ruby 1.9.3p385 and rails 3.2.12, if that makes a difference.

You can use the debugger gem if you are just using a regular text editor. I have found IDEs like RubyMine to be pretty nice though at giving you a visual debugging environment when you are first starting out.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

UxP posted:

The Debugger gem supports remote connections for people less inclines to Kitchen Sink IDEs, which I've found super loving useful as of late. Somewhere in the boot process of your app (like inside 'config/environments/development.rb') toss this in

code:
require 'debugger';
Debugger.start_remote
Then, anywhere else in your application just throw in the same "debugger" call as you would otherwise. If you run your app at this exact moment, you might notice that the debugger seems to pass over the breakpoint. But no fear, in another terminal window, connect to the debugger session with `rdebug -c`, and the next time you pass over that debug breakpoint it'll catch and you can do your thing.

'ruby-debug' for 1.8.x also supports this exact same thing, FWIW. There's some very sparsely documented features around that, like the ability to pass in the host and port you bind to so you can run concurrent remote debugging sessions (for like a web worker and a job worker), or truly remote sessions.

Thought I'd just throw this info out there. Doesn't seem like many people know about this. If anyone uses Pow, now you don't have any excuse for not debugging.

This is cool thanks. I had a feeling there was probably a way to do it, but I haven't really done remote debugging outside of an IDE, so this makes it easy.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Pardot posted:

I was making pourover coffee for attendees all morning in front of the main stage, so there is a small chance you had some :buddy:

The tall guy making coffee?

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Bob Morales posted:


@widgets = Widgets.all

THERE ARE 2.3 MILLION ROWS IN THE WIDGETS TABLE

Gotta be careful with those scaffolded controllers

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Hefty posted:

Speaking of IRB, I just found out about Pry. Even though I only know how to use the basic features (new to Ruby as well), it looks pretty awesome. Check out the intro screencast http://pryrepl.org/.


Both of these are awesome, thanks for the heads up.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

raej posted:

Does anyone have a good gem for a popup overlay? Basically when a button is pressed, I'd like to see a form pop up with some info from the page the button was on, and some blank form fields for a user to add info into.

So let's say you're on the Pink Floyd Dark Side of the Moon page. You click "Add to collection" and a popup appears asking you to check what formats you have the album in (CD, vinyl, etc) and quantity.

Something like a lightbox?

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

raej posted:

Something similar, but with another page. In this case it would be /collection/add which is a form, from the /albums/1 with populating info from /albums/1 in the /collection/add form.

You can do an AJAX request to populate the div for the lightbox with the collections form. Auto populate the field you need from from the selected album then post to the collection when you submit the form. I have done something similar and that was the way I did it.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Cocoa Crispies posted:

Start with a link or button to go to a new view that has the collections form. Add a remote: option that does that over AJAX and puts it in a lightbox (you may need to teach the action how to render without a layout). That way you get progressive enhancement.

This would probably be the best way start out, thanks for that :)

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Deus Rex posted:

This is a very vain and possibly stupid question, but is there any way to customize the colorization of output from the rails CLI? I really like my terminal color scheme but it's like Solarized in that it fucks with bright colors to make them shades of gray. That means the bright green from the rails CLI (like when it creates a file for instance) are basically unreadable.

You could use Pry and then theme it easily with (https://github.com/kyrylo/pry-theme)

EDIT: I would advise using Pry over the standard Rails CLI regardless

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

foutre posted:

Apologies if this is the wrong place to ask this. I have basically no knowledge of programming (like, I knew Java and Visual Basic in middle school, but haven't programmed in the last seven years). Now though, I want to make a web-app (I think) that would basically just let people submit forms on a site, and then spit out a generic email response.

I have a good three months to do this, and want to figure it out myself. Would Ruby on Rails be a good way of doing this, and if so, what are some good resources for getting started?

At the moment I'm using codeacademy's Ruby track, that teaches poo poo like "what the hell does && do". I'm also taking CS 101 online from Stanford, that is basically "what is a program". Beyond that though, I'm not sure how to best go about teaching myself. Should I get a dummies book? Are there online resources I'm missing? I'd love help, thanks a lot.

e: Should I learn Python first like the FAQ suggests, or would I be ok going straight into Ruby?

Michael Hartl's Ruby on Rails Tutorial would probably be a really good place for you to start. It has you built out a simple web app (basically a Twitter clone last time I used it but it could have changed). This would probably give you a good base to understand all of the pieces of Rails put together for a full app. For such a simple app like you are suggesting it might just be easiest to dive straight in to Rails and trying to implement it rather than trying to build more of a foundation first. If you really want to keep going with programming learning more about Ruby or Python would definitely be a good place to start and keep going what you are doing.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

Oh My Science posted:

I have started looking for a junior rails dev position and it seems like a lot of them require Angular experience now. Having very little experience with it I'm not sure where to get started here. I have created the basic hello world angular + rails api app but I imagine they want a little more exposure than that. Can a more experienced rails dev tell me what kind of demo app / project I should work on to impress potential employers?

I struggle with this sometimes too, I don't really have a great "creative" mind to break out of the usual sample apps when learning a new framework or language. If anyone else out there has input good things they do to come up decent side apps to work on I would be really interested. I tend to get stuck too much in creating solutions for my job which doesn't help since I can't open source it.

For myself what I have been trying to do is find basic stuff in your life where you might thing a web app could potentially be useful. Even if its something that has been rehashed like a To-Do or note taking app its worth it to just get something out there that is completely your own, and has your own coding style. One interesting thing I found recently is a bunch of open APIs for random bits of city data (http://www.socrata.com/customer-spotlight/). It has stuff like 911 call data, lists of local parks, etc. Especially for JS MVC frameworks I have found this might prove somewhat helpful to act a data source you can just tie in to and build a simple single page app that will break away from the repeated example apps out there.

MrDoDo fucked around with this message at 01:11 on Feb 4, 2014

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

USSMICHELLEBACHMAN posted:

Thanks, I'll at least learn how to talk about this stuff. I guess I'm frustrated because I've gotten the 'I guess we were looking for someone a bit more senior' line a few times now and really the only Rails thing I'm definitely inexperienced with is operating at scale. (But it could just be that I've said dumb things during interviews. Or that I'm applying at places that don't know what they want).

I've asked a bit in the jobs thread, but I'll ask here: Aside from applying to everything on linked in, any leads for tracking down junior level rails positions? I've got about 2 years under my belt but like I said, it wasn't at any kind of scale. I feel like I should be a shoe-in for a jr position but I havent had a lot of luck yet.

I was in a very similar situation as you until I got my current job a couple of months ago. I started to think it was a trend that Rails jobs are looking for "10+ years experience ninjas (really 10?!)". I ended up finding a place that isn't as "Standard Rails Shop" which was good because they were flexible with my experience and I got a more mid level position with 2 years experience, but also not so great because they aren't really as good about things like TDD or Agile which makes it hard for me to keep those skills up since its all on my own. Also I got my current job through a recruiter, so if you are desperate for a middle of road job to just get some skills up and make some money that might be an option. Figured I would share my experience, but keep after it there are definitely places out there.

MrDoDo fucked around with this message at 03:05 on Feb 22, 2014

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

EVGA Longoria posted:

I'm not looking for handholding through the entire process of developing a web app. I want to get up to speed on how to best use Rails. Something like Eloquent Ruby or Well Grounded Rubyist, but for Rails.

The Rails 4 Way sounds to be more like what you want. There is also a version for 3 if thats what you are using.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

EVGA Longoria posted:

Can anyone comment on rails-api vs the full Rails experience?

I'm pulling out a Rails built API to be a smaller service. Because we're using Devise and Doorkeeper, it's a lot simpler to keep it on Rails vs splitting to Sinatra/Grape. Any benefits to paring it down to rails-api?

I like using it for APIs because out of the box it won't generate a bunch of view crap I won't use. Also just generally feeling like its a bit more speedy, though thats just anecdotal.

If you are building a straight JSON API I think its a pretty good way to go. It seems to cut out a lot of bloat that would be necessary in a full stack Rails app, while still keeping a lot of the baked in nice pieces of Rails that you would otherwise have to add to a Sinatra/Grape app (i.e Security)

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

xenilk posted:

Random questions but what would you recommend someone who's almost done with the rails tutorial ebook (I'm at chapter 10/12) and has done the Code School classes and would be looking for something to continue learning?

Find a pet project and just starting working on it. Its the best learning experience you can get. Also try your best to do as much TDD as possible while doing it. If you want to learn how to be a better ruby programmer I would suggest the books Eloquent Ruby (haven't read it yet but hear great things) and Metaprogramming Ruby.

EDIT: Also The Rspec Book and Practical Object Oriented Design in Ruby are great as well.

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

xenilk posted:

Just to let you know that I got the book a few days ago and I can tell you that I enjoy it quite a bit (I'm already at chapter 5). I'm also starting to work on a pet project, using Git and TDD. Thank you! :)

Awesome, glad to hear. Getting hands on TDD is a low pressure environment is the best thing you can do.

Also there was talk earlier about RSpec vs Test Unit. Starting with Rails 4 the testing framework inherits from Minitest which has a spec style. RSpec can definitely be pretty verbose in my opinion so this gives a pretty decent alternative

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

kayakyakr posted:

It also combines with the way I code: pre-writing tests means I can't stream-of-thought program which essentially kills my 2 hour bursts of extreme productivity and afterwards I move on to the next task rather than going back and filling out the test.

This has been one of the hardest things for me with testing is getting in to the "TDD mindset", instead of using coding as both exploratory and implementation, then just kind of moving on once things are done. I am starting to realize thought that I think the whole idea of writing your tests before your code is a bit misleading, since there is a completely valid need to have some of a coding spike first to get things going.

Adbot
ADBOT LOVES YOU

MrDoDo
Jun 27, 2004

You better remember quick before we haul your sweet ass down to the precinct.

jiffypop45 posted:

Anyone have any specific sites that teach ruby well? Working on a rails application at work and I'm unfamiliar with both ruby and rails (coming from an asp.net c# mvc background). I usually use pluralsight but I wanted to check and see if anyone else knew any good ones? Some of my coworkers are using code academy.

Michael Hartl's Rails Tutorial was the best thing when I got started with Rails. I haven't followed it since and it has been 5 years or so. I have have been meaning to go back and check it out for Rails 5 though.

Railscasts used to be a de facto resource until the guy basically rage quit. Its still helpful though for older versions of Rails or learning some of the basics. Much of the material is fairly out of date though. For more up to date video tutorials Go Rails seems to have picked up the torch.

RubyTapas is also another long running site that focuses more on pure Ruby.

I jumped on SafariBooksOnline back when they had a sale for $199 a year (I believe it's $399 a year normally). If you have a serious tech book buying addiction, like I did, I feel like this can really pay for itself. Having instant access to both books and videos from dozens of publishers has been really nice, and I know they have a lot of up to date books on Rails and Ruby there.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply