Quantcast
Channel: Teach Me To Code » Ruby on Rails
Browsing latest articles
Browse All 34 View Live

Ruby on Rails: Getting Started Part I

Most people are fairly familiar with the basic idea of a database driven website. More specifically, they understand that data is stored in the database and somehow makes it into the web page the...

View Article



Ruby on Rails: Getting Started Part II — Controllers

When I started writing part II, I started writing about models. As I got a little further along, I realized that it would be more helpful to provide an overview of the controller, which provides the...

View Article

Installing Phusion Passenger on Debian Etch

I really have enjoyed working with phusion passenger. It’s made rails setup and deployment a breeze. I did have a little trouble getting it running on my server the other day, though. Here’s what I had...

View Article

content_for: Multiple yields in the same layout

Have you ever wished you could call yield multiple times in the same layout in order to get extra stylesheets, javascript, or a dynamic sidebar? Having worked on several projects that needed this soft...

View Article

Rails Metal Example #1: Authentication

Last week, I wrote a post listing 9 ways to use rails metal. This is an explanation of the first way to use Rails Metal: Check Authentication. We’re setting up this Rails Metal to handle two scenarios:...

View Article


Image may be NSFW.
Clik here to view.

Ruby on Rails: Getting Started Part III — Models

Rails Developers do it with Models I saw a t-shirt at Mountain West RubyConf this year that said “Rails Developers do it with Models.” Of course, they were talking about the classes we use to access...

View Article

Quick Tip: Knowing if an Object’s Attribute is Empty or Nil

I was browsing the ActiveRecord documentation and I came across notation that looks like this: User.name? When I looked more closely, I realized that it replaced all of the places where I had something...

View Article

9 Resources for New Ruby on Rails Developers

If you’re new to Ruby on Rails, you sometimes don’t know where to start with Ruby on Rails. Here are some resources that have helped me become familiar with Ruby and Ruby on Rails. Ruby Guides The...

View Article


Rails Metal Example #4: Redirecting Affiliate Links

A week and a half ago, I posted 9 Ways to Use Rails Metal. The fourth way I listed was “Redirecting Affiliate Links.” The basic idea is that you can set up http://mydomain.com/hosting to go to the link...

View Article


Print Debug Information to Its Own Log

Setting up a Debug Log Have you ever been debugging your Rails application and watching the development log fly by wishing that you could put output just the information you need to its own log?...

View Article

Rails Metal Example #5: Static Content

Serving static pages with Rails Metal is actually very simple. Here are the assumptions we’re making. Each static page’s content is made up of valid HTML. Each static page has a path and content stored...

View Article

RSpec vs Test::Unit

Having used both Test::Unit and RSpec, I have to agree with Jim Weirich: the difference between the two is primarily semantics. It seems to me that functionally, they are both equally capable of...

View Article

Image may be NSFW.
Clik here to view.

Ruby on Rails: Restful Links When You Don’t Know the Class

I had a friend email me a week or so ago about generating a link from your restful routes when you don’t know the class. Here’s a quick thumbnail of the scenario. You have a bunch of restful routes...

View Article


Rails Metal Example #7: Tracking Analytics

Last month, I posted 9 Ways to Use Rails Metal. This is the seventh way to use Rails Metal. A week ago, I posted Ruby on Rails: Polymorphic Associations with Mixin Modules which included an example of...

View Article

Good-bye Rails Envy, Hello Ruby 5!

For those that followed Rails Envy, you’re probably aware that Gregg Pollack and Jason Seifer have discontinued the Rails Envy podcast. The Rails Envy website is still there, for those who are checking...

View Article


Ruby on Rails: Nifty Generators

While looking at articles and resources about authentication in Ruby on Rails I ran across a set of generators written by Ryan Bates of Railscasts. You can find the nifty generators at...

View Article

Screencast: Basic Ruby on Rails Routing

This is my first screencast. I’ve learned a lot about recording screencasts while doing this. The screencast was recorded using a free trial of Camtasia for Mac. The trial is up in 30 days, so I’d...

View Article


Deployment with Capistrano

One problem that seems to face people when they’re attempting to move their applications into production is the best way to manage deployment of their application. This is where tools like capistrano...

View Article

Rails Templates: My Template

I just read the article by Pratik Naik from the Rails Core Team regarding Rails Templates. Have you ever wished you could start out your Rails application with all of your gems installed and all of...

View Article

More ActiveRecord Notes

I started reading ActiveRecord::Base a few days ago and found 8 things that I didn’t know about that it offered. I also only made it about 1/4 of the way through the code. Here are a few new things...

View Article

Rails 3 – Building a Blog – Part 1: Test Setup & Generators

Every good project needs a good setup. In this episode, I set up a github repo, create a new rails application, hook in Cucumber and Rspec, write a Cucumber feature, and write the code to make it...

View Article


OAuth with the Twitter Gem

Twitter just turned off Basic Auth and is forcing application developer to use OAuth. Here is a demonstration of how to add Twitter OAuth to your Ruby on Rails Application. Download 90.9 MB Download...

View Article


Rails 3.0.3 Setup – Delicious Clone

Here is what I’ve done to create this application: Use the ‘rails new’ command to create a rails application Set up the Gemfile Configure the Database Install Cucumber Install Rspec Install Devise...

View Article

Building a Rails Curriculum

A few weeks ago I was looking at Peter Cooper’s Ruby course and wound up proposing a Basic Ruby on Rails course. Interestingly enough, I’ve been named the instructor for the course. I’ve been working...

View Article

Switching to HAML – Delicious Clone

This is a quick demonstration of how to switch your Rails 3 application to HAML from ERB.

View Article


CanCan: Setting Permissions – Delicious Clone

In this installment in the Delicious Clone, we use CanCan to set some permissions on the Bookmarks Controller. Next week, we’ll finish the bookmark creation process and the following, we’ll add...

View Article

Single Table Inheritance – Ruby on Rails Tutorial

  Single Table Inheritance is a great way to handle related models that descend from the same class. The classic example is a Car class with Ford, Chevy, and Honda subclasses. This Ruby on Rails...

View Article

CoffeeScript Basics – A Teach Me To Code Tutorial

  CoffeeScript is now going to be a default installation with Ruby on Rails. So, I installed CoffeeScript and NodeJS and have been playing with it for the last hour or so. Here are the basics you need...

View Article

Rails 3.1 Beta – Sprockets, CoffeeScript, and JQuery – A Teach Me To Code...

  Ruby on Rails 3.1 is moving to use Sprockets to compile CoffeeScript into JavaScript and include JQuery in it’s JavaScript by default. This is a quick demo of how it all hangs together to manage your...

View Article



Many to Many Associations in Ruby on Rails – A Teach Me To Code Tutorial

I had several requests in UserVoice to provide a Many to Many tutorial in Rails. This is a demonstration of how to put together a “has and belongs to many” association and a “has many through”...

View Article

Freelancing Advice – Teach Me To Code Podcast

I’ve had two people ask me about freelancing within 1 day of each other. So, I’m going to give some advice. I also talked about finding freelance clients a few weeks ago in this episode. Talk to other...

View Article

Building a Star-Rating System in Ruby on Rails with jQuery

Specification Clicking a star rating turns on the stars to the left of the star I clicked. Clicking a star submits the star rating. When I refresh the page, the star ratings should be persistent....

View Article

Pivotal Labs’ Javascript Setup

One of my clients had Pivotal Labs build them a website. After Pivotal Labs finished the project, they helped them find a developer to maintain it for them. I took over from him. This last week, I had...

View Article


Create a ‘Like’ or ‘+1′ button with make_flaggable

With the recent release of the Google Plus beta (ask me for an invite if you want one), I felt it appropriate to show a simple way to create a Like or +1 button for your Rails application. The app and...

View Article
Browsing latest articles
Browse All 34 View Live




Latest Images