What Happened When We Talked Rails with the Experts – with transcript

Sarah Hawk

The latest in our Talk with the Experts series of free online chats took place this morning. The subject was Rails and the expert was SitePoint Group senior developer Mal Curtis. The session was a really valuable one in that there were plenty of beginners present, so we talked a lot about getting started with Rails and some great resources came out of the hour. To save you sifting through the entire transcript, I have listed those resources below.

If you missed the session today and are interested in future ones, next week we have WordPress followed by Regular Expressions the following week. You can get more details about those sessions here.

If you missed the Rails talk this morning because you weren’t aware of it, you can sign up for email notifications of future sessions here.


Here are those resources:

SitePoint books:
Simply Rails 2
Rails Deep Dive

Ruby on Rails Tutorial by Michael Hartl

Programming Ruby (2nd ed): The Pragmatic Programmers’ Guide

http://iwanttolearnruby.com/

An awesome interactive Ruby tool

A Curated List of Resources for Ruby and Rails Learning

Dealing with caching in Rails – A slideshow by Mal

And if you’re interested in exactly what went down this morning, here is the full transcript:

[21:30]<HAWK> Welcome to those people that have just joined. MalCurtis is our expert today – he’s a senior developer for us (the SitePoint group)

[21:31] <MalCurtis> Hi everyone

[21:32] <MalCurtis> So I use Rails in my everyday job, and personal projects too

[21:33] <prosem> I am using coldfusion but am interested in rails

[21:33] <MalCurtis> Rails is made to be easy to get into

[21:33] <MalCurtis> I’d recommend just jumping in if you’re considering it

[21:33] <Jerry> Since it’s slow I will ask the dumb question of the day — what exactly is Rails?

[21:33] <MalCurtis> there are plenty of getting started tutorials and videos on the web

[21:34] <petarpetrovic> I’ve began learning Rails a few days ago and I am doing pretty well for now, but I’d like to know what are the best strategies to learn Rails

[21:34] <lori> i built a few apps in a class but I want to know more

[21:34] <TzeLei> I liked it, but got stuck deploying it to my HostMonster hosting service.  :D

[21:34] <MalCurtis> Rails is a framework built in Ruby, designed to empower developers to rapidly create web applications

[21:34] <TzeLei> they didn’t know rails at all back then; maybe they do now.

[21:34] <corinachristina> i havent started yet i am very interested in learning :)

[21:34] <MalCurtis> I’d say the easiest way to get Rails hosted would be to use Heroku, which has a free teir

[21:34] <MalCurtis> and is as easy as doing ‘git push heroku master’

[21:34] <MalCurtis> Git knowledge is required :D

[21:35] <MalCurtis> but they have plenty of getting started guides for people not familiar with it

[21:35] <HAWK> For anyone that doesn’t have Git knowledge, I have one of these sessions on it coming up next month

[21:35] <TzeLei> yeah, i LOVE the “convention over configuration” approach in Rails.

[21:35] <MalCurtis> petarpetrovic: To answer your question, I personally think the best way is to have a goal project

[21:35] <HAWK> We also have a new Rails course coming up on Learnable shortly

[21:35] <TzeLei> oh cool, thx @Hawk!  i’m planning to learn Git.

[21:35] <Jerry> I thought Git was all smoke and mirrors! (only 1/2 :) )

[21:35] <MalCurtis> I find learning by doing to be the way I really learn

[21:36] <BradZ> Is the new course for beginners?

[21:36] <MalCurtis> but people often have different methods of learning

[21:36] <MalCurtis> if you’re more of a visual learner, definitely check out the Learnable Rails’ courses

[21:36] <MalCurtis> which are Video heavy

[21:36] <HAWK> TzeLei Here are the details of the Git session http://www.timeanddate.com/worldclock/fixedtime.html?msg=Talk+Git+with+the+Experts&iso=20130710T18&p1=179&ah=1

[21:36] <TzeLei> cool, thx!

[21:37] <MalCurtis> BradZ I’m not familiar with the new course, but the existing Rails course is friendly for beginners

[21:37] <lori> Is there a project in the new rails course? What is it?

[21:37] <MalCurtis> So I’d imagine the new one will be either a beginners one as well, or build on the first

[21:37] <David> Can I ask about the minimum skills needed to find work as a junior ruby dev?

[21:37] <petarpetrovic> the problem with the existing course is that it’s a little bit… outdated :)

[21:37] <HAWK> Yeah, the new course is coming to update that :)

[21:38] <MalCurtis> David: I’d say having a working knowledge of Ruby or Rails (you said Ruby rather than Rails) would be a starting point

[21:38] <HAWK> I’m not sure about that lori – I don’t know the course details yet

[21:38] <MalCurtis> If you’re not happy doing the basics of setting up, for example, your own blog, then you might need to spend a bit more time practicing

[21:38] <MalCurtis> The blog example was the very first ‘Rails’ tutorial when it was released

[21:39] <MalCurtis> A simple concept, with a few data models that show off the basics of Rails

[21:39] <TzeLei> Two great things from Japan…  ramen, and Ruby.  :D

[21:39] <MalCurtis> :D

[21:39] <Kate> What is the main advantage of using Rails in development?

[21:40] <MalCurtis> Kate: Speed of development

[21:40] <MalCurtis> Rails provides an incredibly versatile set of tools for modelling your data, modifying your data, and getting that content onto a web page

[21:40] <petarpetrovic> since I’m a complete beginner in Rails, coming from PHP, and since I prefer reading books over watching videos, what are some of the beginner books for Rails that are worth reading?

[21:40] <MalCurtis> quickly

[21:40] <Jerry> Is Rails tied to Ruby as an implementation language, or can you use it with other programming languages?

[21:40] <Kate> We are used to seeing Ruby on Rails, but can you do PHP on Rails?

[21:40] <MalCurtis> @Jerry: Rails is the name of the framework, it’s heavily tied to Ruby

[21:41] <MalCurtis> however, Rails has been so successful in it’s convention over configuration style of framework that many frameowrks in other languages model themselves after it

[21:41] <Kate> So Rails is not just a pure MVC structure.

[21:41] <MalCurtis> Kate: Basically the same answer I gave for Jerry.

[21:41] <MalCurtis> Well it implements the MVC structure, but it gives you so much more than just a loose structure

[21:42] <Jerry> Thanks, MalCurtis

[21:42] <Kate> Yes, thank you!

[21:42] <MalCurtis> by providing sane defaults and other code, you can really get things done quickly

[21:42] <MalCurtis> For a (basic) example, all strings have inflection mixed in

[21:42] <MalCurtis> so if I want the plural of a word

[21:42] <MalCurtis> I just call #pluralize on it

[21:42] <Jerry> Thank you, Hawk

[21:43] <Kate> Is it also easy to learn quickly – or more quickly than other frameworks?

[21:43] <MalCurtis> Each framework has it’s quirks

[21:43] <MalCurtis> the great thing I’ve found with Rails is that it is very easy to get up and running

[21:43] <HAWK> petarpetrovic – We also have another Rails book coming out shortly I believe, to update Simply Rails 2 which is getting a bit dated

[21:43] <MalCurtis> But I’m still finding things I didn’t know about

[21:43] <MalCurtis> You’re not limited to having to know all the ins and outs

[21:43] <drale2k> @Kate: it is easy to learn to get something quickly out there. I also came from PHP a year ago and i feel ok now using Rails

[21:44] <drale2k> but you need to get used to the ” magic” that happens under the hood and sometimes it can be confusing

[21:44] <Kate> Thanks drale2k

[21:44] <cpradio> petarpetrovic: I’ve been going through Simply Rails 2 (https://learnable.com/books/rails2) and plan on going through Rails Deep Dive (https://learnable.com/books/railsdeepdive) next. So far, I’ve enjoyed what I’ve read in Simply Rails 2

[21:45] <petarpetrovic> cpradio: is Simply Rails 2 for Rails 3.x or what?

[21:46] <cpradio> Rails 2, but as HAWK stated, another book is coming soon

[21:46] <cpradio> I got Simply Rails 2 so I could at least get a basic foundation of it before trying a more advanced (up to date) book

[21:47] <drale2k> is sitepoint running on rails or wordpress? (or something else)

[21:47] <RonaldRoe> I’ve been kicking around jumping into a backend language. I’m somewhat familiar with Ruby. Would you recommend jumping straight to Rails?

[21:47] <MalCurtis> Rails 2 is a bit outdated, Rails 3.2 is the current release and Rails 4 is the next up

[21:47] <MalCurtis> Absolutely RonaldRoe

[21:47] <MalCurtis> If you want to set up a web app, Rails is the most popular choice in Ruby

[21:47] <MalCurtis> Sinatra would be the second

[21:47] <MalCurtis> Sinatra is often preferred for smaller apps

[21:48] <MalCurtis> Rails is rock solid for larger scale apps

[21:48] <lori> Im a little nervous about trying Mongodb though

[21:48] <HAWK> drale2k: SitePoint runs on WordPress

[21:48] <MalCurtis> You don’t have to use Mongo with Rails, so that’s a separate issue :D

[21:48] <lori> since Im used to sql lite and postgres.

[21:48] <HAWK> drale2k: Learnable is Rails

[21:48] <MalCurtis> And using it in a project will kill your nerves

[21:49] <lori> I wanted to follow a tutorial for a blog and it uses mongo. Seems like a good idea but homebrew gave me trouble

[21:49] <cpradio> petarpetrovic, if you want something more “up to date” check out Rails Deep Dive (https://learnable.com/books/railsdeepdive), it is using Rails 3.1, I haven’t start it yet, so it may be a big jump for a beginner, but it would at least be close to the latest

[21:49] <RonaldRoe> What sql db would you recommend? I’ve had massive issues trying to get MySQL to work properly with Rails when I’ve tried to learn.

[21:50] <lori> I had no trouble w sql lite

[21:50] <drale2k> HAWK: Do you guys have performance issues because of rails? I donÄt know how much traffic you have but many argue rails scales badly

[21:50] <lori> but for production, you have to switch to pg with Heroku

[21:50] <TzeLei> @Mal, does Rails support Apache Cassandra DB?

[21:50] <MalCurtis> drale2k: Performance issues are as much about coding practices as ‘Rails’

[21:50] <HAWK> Not that I’m aware of drale2k – but Mal could answer that better – he wrote it

[21:50] <petarpetrovic> cpradio: I already have it, not exactly what I need right now

[21:50] <MalCurtis> I wrote a lot of Learnable

[21:51] <MalCurtis> and we definitely had performance issues that needed to be solved

[21:51] <MalCurtis> (and probably still do)

[21:51] <MalCurtis> but they were solved through common practices

[21:51] <MalCurtis> caching, database indexing, putting things into the background

[21:51] <MalCurtis> the usual

[21:51] <drale2k> MalCurtis could you give 1 or 2 tips on what to avoid performance vise with Rails? 

[21:51] <drale2k> based on your experience with Learnable

[21:51] <lori> what specific gems helped with performance?

[21:52] <MalCurtis> The easiest thing you can do is ensure you set up a correct touch chain

[21:52] <cpradio> petarpetrovic, what are you looking for? any specifics you can provide?

[21:52] <MalCurtis> and then cache correctly

[21:52] <lori> what is a touch chain

[21:52] <MalCurtis> For example, if you have a category and ‘posts’ in a one to many relationship

[21:52] <petarpetrovic> cpradio: I basically need a book for beginners, but for Rails 3.2 at least

[21:52] <drale2k> MalCurtis ok, i think that got easier with cache_digest now right

[21:52] <MalCurtis> On the post you can tell it to ‘touch’ the category when you edit the post

[21:52] <MalCurtis> which means the category’s ‘updated_at’ will be set

[21:53] <MalCurtis> so now if you cache things based on the ‘category’ updated_at, you can expire the cache when the updated_at value changes

[21:53] <Jsoh> How long will this live expert discussion be on? I ran across this by chance and I don’t have any particular questions right now, which is unfortunate because this looks like an excellent way to get direct feedback.

[21:53] <drale2k> MalCurtis but how to ‘touch’ HABTM relations? LIke you said categories and posts, that’s likely a HABTM relation. You can’t call touch on those or?

[21:53] <MalCurtis> Doing cache expiry based on updated_at rather than times is best

[21:53] <HAWK> Jsoh It runs for another half hour

[21:53] <MalCurtis> drale2k You still need to do a little bit of massaging,

[21:54] <MalCurtis> there is the after_update callback in a HABTM

[21:54] <MalCurtis> which I believe you can use

[21:54] <drale2k> MalCurtis alright cool

[21:54] <mo> Hey guys

[21:54] <MalCurtis> You also need to be careful to manually #touch after you delete objects

[21:54] <HAWK> Hey mo

[21:55] <MalCurtis> since they’re not technicaly updated, they don’t call the touch chain

[21:55] <TzeLei> Crap!  Work just called… Sev1 Live issue.  Bye all!  :(

[21:55] <MalCurtis> :D

[21:55] <MalCurtis> bye

[21:55] <HAWK> See ya

[21:55] <drale2k> do you use memcached or redis?

[21:55] <TzeLei> thx Mal and HAWK!  i’ll try to attend the next session.  EVERYONE, have a great evening!  :)

[21:55] <MalCurtis> drale2k: Both

[21:56] <mo> MalCurtis, question about Ruby language. I’ve used Java, C#, and now work with PHP. Picking Ruby slowly. I find it a bit alien. Did you have experience with a C-syntax language like PHP before Ruby? And if so, how do you find the learning curve stacks up?

[21:56] <MalCurtis> memcached is great for handling auto expiring caches

[21:56] <MalCurtis> Redis is solid for data you want that isn’t ephemeral

[21:56] <MalCurtis> although Redis can be used in place of memcached if you want to avoid multiple servers to manage

[21:56] <MalCurtis> (software servers, not ness hardware)

[21:56] <drale2k> ah, so things like template caching would go into memcached

[21:56] <MalCurtis> @mo: I worked on PHP before Ruby

[21:56] <drale2k> what would you store in redis?

[21:57] <MalCurtis> and I found Ruby a breath of fresh air

[21:57] <MalCurtis> it’s the opposite of the verbose languages like PHP, C++ etc

[21:57] <mo> The syntax is certainly appealing. No {} no “function”

[21:57] <MalCurtis> It’s expressive

[21:57] <MalCurtis> drale2k: Redis is insanely fast, so often you’re better writing to redis in a request, than to the database

[21:57] <MalCurtis> our job queue runs in redis

[21:58] <drale2k> @mo I came from PHP to and it was really different. I jumped on Rails first on just now i am looking at some Ruby tutorials

[21:58] <MalCurtis> but also every page request is logged to the database, but since that write would add to the load of each request, we put it in redis first, thten process it from tehre

[21:58] <MalCurtis> Redis is great for the ‘social’ model. relations like x is friends with y can be easily modelled in Redis in a incredibly fast manner

[21:59] <MalCurtis> however it’s quite alien to people who are used to the relational model of DB’s

[21:59] <drale2k> MalCurtis So you would have to replicate that relation from active record to reids or ?

[21:59] <cpradio> petarpetrovic: One thing I frequently do, when I can’t find the exact book I need, I visit a library and browse any books they have on the subject to see 1) does it fit what I need, and 2) do I like the author’s writing style. Then I know which book I want to buy. I know that doesn’t exactly help, but unfortunately, Ruby/Rails is too new to me at t

[21:59] <cpradio> his point :(

[21:59] <MalCurtis> since you kinda have to manage your data across multiple tables, and define your own relations really

[21:59] <drale2k> andthen have a bg job pick it up and save it to the db later?

[21:59] <MalCurtis> drale2k no, i’d do it purely in Redis

[21:59] <MalCurtis> for the friends type relation

[21:59] <drale2k> oh

[22:00] <mo> How long did it take you to feel confident using Ruby? I feel like I can solve almost any problem with PHP, which probably isn’t true, but I’ve gotten into a flow with it. How long did you did it take you to get into a flow with Ruby?

[22:00] <MalCurtis> for the logging of requests, we just store the requests data as json

[22:00] <MalCurtis> then process it afterwards

[22:02] <MalCurtis> @mo: Regarding getting comfortable with Ruby

[22:02] <petarpetrovic> I’m so much used to PHP way of doing things, and the biggest problem with my learning of Rails is that I feel I’m completely sandboxed into the “right” ways to do things. How do I get past that kind of mindset?

[22:02] <MalCurtis> I’d say it took me a year to say that I didn’t have to google language features on a daily basis

[22:03] <mo> How much of your time were you dedicating to learning Ruby? 

[22:03] <drale2k> petarpetrovic You don’t absolutely need to learn Rails just for the hype. I jumped to Rails because PHP and most of it’s frameworks were so bad. Today you have Laravel

[22:03] <MalCurtis> petarpetrovic I’m not sure. I definitely find that sometimes I know i’m not doing it the right way

[22:03] <cpradio> petarpetrovic: No idea. I’m in the same situation, so if you figure it out, let me know. I personally think it is because I haven’t really dedicated enough time and effort or pure focus to Rails

[22:03] <mo> Oh, sweet sweet Laravel

[22:03] <MalCurtis> but you have to be pragmatic. If things are working, you’ve done your job

[22:03] <MalCurtis> just keep learning and you’ll get better at fitting into the Rails mindset

[22:03] <MalCurtis> I still use inheritance to provide functionatlity rather than mixins sometimes

[22:03] <MalCurtis> and that’s against the ‘rails way’

[22:03] <David> I’ve found having a solid understanding of ruby has made learning rails much easier.

[22:04] <petarpetrovic> I’m dedicating all my free time into learning Rails, so I guess the best thing is to just keep doing it and eventually I’ll get used to the Rails ways of accomplishing things

[22:04] <MalCurtis> @mo: No time ‘dedicated to learning’, mainly just using it in my day job meant I had to learn as I went

[22:04] <Jsoh> Are there any plans to take the best questions from an expert chat and post the responses up on the Learnable site?

[22:04] <mo> Ah

[22:04] <cpradio> MalCurtis: Would you say the more you can put your focus on Rails, the easier it is to get past the mindset Rails places on you? Did you have to do a small-medium size project before it began to feel comfortable?

[22:04] <drale2k> David oh yeah, when you don’t know Ruby at all like me in the beginning, everything is so “magic”

[22:04] <HAWK> Jsoh We were thinking of making a few ‘Lightning talks’ of questions that would be good answered on video

[22:05] <MalCurtis> cpradio: Absolutely, you can’t understand the whole of rails without actually using it to understand why those concepts are useful

[22:05] <HAWK> But so far there haven’t been any that really lend themselves to it

[22:05] <MalCurtis> Watching a video on the concepts won’t help you understand the actual reality of why they’re powerful

[22:05] <petarpetrovic> is there a book that explains why are things done in Rails the way they’re done? I think that might help me the most right now

[22:05] <cpradio> MalCurtis: I think that is my struggle. Some of the books, the examples are so simplified or not what I’d normally see in my line of work, that I’m not seeing the big picture

[22:06] <cpradio> I second petarpetrovic

[22:06] <MalCurtis> To be honest, a lot of people recommend great books

[22:06] <MalCurtis> but I’ve never read a rails book through and through (

[22:06] <MalCurtis> :(*

[22:06] <David> I’ve found Michael Hartl’s book to be a really good resource -> http://ruby.railstutorial.org/ruby-on-rails-tutorial-book

[22:06] <drale2k> petarpetrovic Most things re done as an extraction of Basecamp, that’s the product from 37Signals were Rails got extracted from by DHH

[22:06] <MalCurtis> Which is most likely just because my work gave me the chance to learn as I went

[22:07] <MalCurtis> Which is not helpful for you guys, but means that I’m unqualified to recommend any

[22:07] <Kate> As a total beginner, having big picture I think helps a lot, not just the one step at a time approach where you don’t see how it all ties in until the end.

[22:07] <MalCurtis> I’m a huge fan of just picking something you want to do, and going for it

[22:07] <mo> Yeah, I really believe in learning the underlying language. Would love to find a deep dive Ruby book that gives you all the details.

[22:07] <HAWK> If anyone knows of any, link them and I’ll compile a list of resources when I do the transcript

[22:07] <MalCurtis> @mo: The pickaxe book is generally recommended as your first stop for Ruby

[22:08] <MalCurtis> http://pragprog.com/book/ruby/programming-ruby

[22:08] <drale2k> The Codeschool “Zombie for Rails” is pretty good btw

[22:08] <David> http://iwanttolearnruby.com/

[22:08] <mo> Hmm cool.

[22:08] <drale2k> they got also Ruby courses

[22:08] <mo> What about Ruby versions? How are gems, frameworks etc for 1.8 vs 1.9 vs 2?

[22:08] <David> http://tryruby.org/

[22:09] <MalCurtis> We use 2 for new projects

[22:09] <David> http://www.learnrubyandrails.com/

[22:09] <MalCurtis> Don’t touch 1.8 ;)

[22:09] <MalCurtis> Gem compatibility is generally extremely good with new versions

[22:09] <Jerry> FYI Hawk — reconnecting after browser crash, the reconnect time to this session was very slow

[22:09] <lori> can you use 2 with Rails 3 or only with Rails 4?

[22:09] <drale2k> Are you on Rails 4 with Learnable?

[22:09] <MalCurtis> We’re Rails 3.2 on learnable

[22:09] <MalCurtis> Rails 4 is not production ready yet

[22:09] <HAWK> Ok Jerry,  noted. Thanks.

[22:10] <MalCurtis> it’s RC4 I think

[22:10] <MalCurtis> although we’re using it on a couple of projects

[22:10] <drale2k> lori: Ruby 2.0 can be used with Rails 3 and 4

[22:10] <MalCurtis> we’ve found it has a few headaches with gem compaitibility

[22:10] <MalCurtis> which means there’s a fair bit of patching, or using branches of gems

[22:10] <drale2k> ah yeah

[22:10] <MalCurtis> so I woudln’t recommend Rails 4 when starting out yet

[22:10] <drale2k> is there a site that can check your gemfile for Rails 4 compatibility?

[22:10] <MalCurtis> also the jump from Rails 2 to Rails 3 was quite large

[22:10] <MalCurtis>  the 3.2 -> 4 jump is not so big

[22:11] <MalCurtis> the core structure stays teh same

[22:11] <lori> are there also problems with Ruby 2. and gems?

[22:11] <MalCurtis> just some small differences between the way things interact which are usually quickly fixed

[22:11] <MalCurtis> lori: Not that we’ve come across yet really

[22:11] <MalCurtis> The main issue with 1.8 and 1.9 was that 1.9 introduced the new hash syntax

[22:11] <MalCurtis> { blarg: :blarg}

[22:11] <David> I’ve heard horror stories about deploying rails apps? Any truth?

[22:12] <MalCurtis> whereas that would have to have been { :blarg => :blarg } in 1.8

[22:12] <MalCurtis> so a lot of people forgot that if their gem supported 1.8, they couldn’t use hte new syntxa

[22:12] <MalCurtis> David: There are horror stories when deploying any apps!

[22:12] <David> True : )

[22:12] <MalCurtis> I’d say the only real issue w’ve encountered when deploying rails has been teh slow time of Rails startup

[22:12] <MalCurtis> we’ve done a lot of work in that regard

[22:12] <drale2k> What do you guys think of heroku? I find it really nie to use but a little bit expensive on scale

[22:12] <mo> So in { blarg: :blarg} the first blarg is a symbol?

[22:13] <MalCurtis> we no longer auto load gems, and are careful when adding gems

[22:13] <MalCurtis> @mo: Yes

[22:13] <MalCurtis> Mo: Both examples are the same, just diff syntax

[22:13] <MalCurtis> drale2k: We love heroku for getting our apps up and out there

[22:13] <mo> Hunh

[22:13] <lori> what do you mean auto load gems?

[22:13] <MalCurtis> We will move from Heroku once we get past maybe 5-6 dynos

[22:14] <MalCurtis> lori: BY default Rails will automatically load all of the gems that you have in your gemfile

[22:14] <MalCurtis> a gem is a separate library that you can use

[22:14] <MalCurtis> so if I install the XYZ gem

[22:14] <drale2k> MalCurtis ok i guess that’s a good strategy. Then you will run your own machines or AWS maybe?

[22:14] <MalCurtis> I can just go ‘XYZ.method’ in my code, and it will automatically require that gem

[22:14] <MalCurtis> We don’t auto load, and we have to ‘require ‘xyz” before we can use it

[22:14] <MalCurtis> but that means we have to handle that dependency, but when we start rails, it’s not having to spend x seconds loading all the gems

[22:15] <MalCurtis> drale2k

[22:15] <MalCurtis> ah!

[22:15] <MalCurtis> drale2k: Yea, AWS is our preferred cloud provider

[22:15] <lori> so you dont just list the gem in the file and then bundle?

[22:15] <MalCurtis> drale2k: Often we’re cheeky and continue to use our Heroku addons since htey’re on AWS too

[22:15] <drale2k> hehe

[22:16] <MalCurtis> lori: Yes we do. Bundler still handles the gems, however if you looks in your config/application.rb there’s a line where all gems are autoloaded

[22:16] <lori> It would be great to have a course or tutorial on using AWS their instructions for cloud hosting are not too easy

[22:16] <MalCurtis> we mess around with that :D

[22:16] <David> I second the AWS tutorial idea.

[22:16] <Jsoh> Yes, please, some more information on AWS.

[22:16] <drale2k> Any tips on monitoring and finding issue before they become a real issue?

[22:16] <MalCurtis> drale2k: Use NewRelic

[22:16] <MalCurtis> they’re amazing for finding the performance bottlenecks

[22:17] <Jsoh> A gentle introduction course to AWS (and other cloud services hopefully).

[22:17] <MalCurtis> you can see which part of your app is slowing down

[22:17] <MalCurtis> We have a good intro book on AWS I believe

[22:17] <drale2k> MalCurtis yeah i use it, i still don’t understand many of the data it shows but it is really powerful 

[22:17] <MalCurtis> http://www.sitepoint.com/books/cloud1/

[22:17] <lori> so when you see the line about autoloading, you just put false and sounds like there is more to do than that.

[22:17] <lori> great thanks I’ll look into that book. 

[22:18] <MalCurtis> @lori: If you replace ‘Bundler.require’ with Bundler.setup it won’t actually require the files

[22:18] <MalCurtis> but will make them available for you to require yourself

[22:18] <HAWK> We have about 10 minutes to go. If you have a question that hasn’t been answered, make sure you get it in now :)

[22:18] <MalCurtis> a lot of gems still need to be required in the config phase, so it’s not a simple ‘swap this out and everything runs faster’

[22:18] <MalCurtis> it can be quite frustrating in fact

[22:18] <MalCurtis> but we’ve spent a lot of time getting out app from 30 seconds to start to only a few seconds

[22:18] <MalCurtis> so it helps us in the long run :D

[22:19] <drale2k> MalCurtis is that startup time after deploys?

[22:19] <MalCurtis> yea, the time required to start rails

[22:19] <MalCurtis> but that also falls into a lot of areas

[22:19] <MalCurtis> since rails is required to load to run tests, run rake tasks etc.

[22:19] <drale2k> so you are aiming for no downtime right?

[22:19] <drale2k> ah right

[22:20] <MalCurtis> We manage no downtime in a slightly different way

[22:20] <lori> would love to have a tutorial on what is needed step by step to do what you are saying…ways to improv performance…a lightning talk and demo

[22:20] <MalCurtis> we run Unicorn for our production servers

[22:20] <MalCurtis> which allows you to send a USR2 signal to it, which spawns new workers with the new codebase, then once they’re loaded, kills the old workers

[22:20] <David> Testunit, minitest or rspec?

[22:20] <MalCurtis> rspec definitely for most rails projects

[22:21] <drale2k> ok so you swap them quickly out

[22:21] <MalCurtis> I’d use testunit if writing an api client or some smaller gem

[22:21] <MalCurtis> since rspec creates a dependency

[22:21] <MalCurtis> but with Rails, I’ve found rspec to make writing tests a lot easier

[22:21] <MalCurtis> it provides great helpers so you don’t have to write so much yourself

[22:22] <drale2k> I think Rspec reads a lot more “human” than the others

[22:22] <MalCurtis> that can be a good and a bad thing

[22:22] <David> I’ve found rspec to have a huge learning curve as a beginner…

[22:22] <MalCurtis> we initially used cucumber, which allows you to write tests in a natural language manner

[22:22] <David> Finding minitest easier to learn TDD.

[22:22] <MalCurtis> “when i visit the log in page I should see a form with email”

[22:22] <MalCurtis> etc.

[22:22] <drale2k> i think Cucumber goes too far because you have to write a lot

[22:22] <David> I agree

[22:22] <drale2k> they were like stories 

[22:22] <MalCurtis> but that just means you write the tests, then the code that interpretts the tests, tehn the code to actually run the tets

[22:23] <MalCurtis> cucumber is good when the developers aren’t writing the tests

[22:23] <MalCurtis> you can get business people, managers etc. who are speccing to write the tests for your features for you

[22:23] <MalCurtis> but that’s not an issues unless you’re part of a much much bigger project

[22:23] <mo> Thanks a lot for the info MalCurtis, and thanks to all the Learnable crew for running this. I gotta jet. Cheers!

[22:23] <drale2k> yeah, luckly i am not at that point

[22:23] <MalCurtis> np @mo! Thanks for coming

[22:24] <MalCurtis> drale2k ditto ;)

[22:24] <Jsoh> Any chance there could be a special payment area someday with “full blown” example Rails apps complete with walkthroughs that explain the decision to design the app that way?

[22:24] <MalCurtis> @jsoh: That’s an interesting idea. We’re always keen to explore new ideas, and I’ll send that one through

[22:25] <petarpetrovic> yeah, that would be great and I’d gladly pay for that :)

[22:25] <MalCurtis> Yea, a lot of Rails tutorials definitely only cover the basics

[22:25] <Jsoh> I think I could have worded that better, but essentially I have found the biggest problem for me (as someone new to web development) is the lack of example apps and tutorials which explain the decisions to build the architecture in that way.

[22:26] <MalCurtis> taking it from basic controller -> models -> view, to include caching, performance tweaks, etc. would be very helpful

[22:26] <drale2k> Jsoh yeah you only get piece by piece from different tutorials and screencast but hardly a big app at one place

[22:27] <Jsoh> I noticed some of the interviews on the site are really great, would love to see more of those.

[22:27] <MalCurtis> On Learnable?

[22:28] <MalCurtis> The jumpcasts are great for little bits of information on a topic

[22:28] <Jsoh> I liked the Sinatra interview, which explained how Sinatra is “not opinionated” and it works great for authentication systems and what not. I’ll check out the jumpcasts more then for sure

[22:28] <HAWK> Couple of minutes left everyone. Does anyone have a question that hasn’t been answered fully?

[22:28] <drale2k> MalCurtis how do you guys handle Payments? I hope i will need that soon to integrate but in the EU we don’t have Stripe. Any good alternative for Rails payments?

[22:29] <MalCurtis> heh, we now use stripe

[22:29] <drale2k> beh :P

[22:29] <drale2k> i’d love to

[22:29] <MalCurtis> Previously we’d used our own commerce setup and Worldpay as the backend

[22:29] <HAWK> Only in the last few weeks though

[22:29] <drale2k> well, i hope  they come to europe soon

[22:29] <MalCurtis> https://spreedly.com/ seems to be the ‘Rails’ go to guys when it comes to using your own payment gateway, but need an interface

[22:30] <MalCurtis> In combination with the Spree Rails ecommerce platform http://spreecommerce.com/

[22:30] <drale2k> Thanks will check it out, THat’s something i’D rather not do on my own

[22:30] <HAWK> Ok everyone, I’m going to cut MalCurtis free now to get some work done. :) 

[22:30] <HAWK> Thanks very much for your time Mal

[22:30] <HAWK> And thanks to everyone else for taking part in the session

[22:30] <drale2k> Thanks a lot guys, this is really helpful! 

[22:30] <Kate> thank you so much!

[22:31] <David> Thanks!

[22:31] <Jsoh> Thanks so much! It’s really a fantastic way to get information.

[22:31] <HAWK> No worries – next week we’re talking WordPress

[22:31] <Jsoh> I think this is totally invaluable. Thanks for being great hosts.

Win an Annual Membership to Learnable,

SitePoint's Learning Platform

No Reader comments

Comments on this post are closed.