Rails 3 Screencasts

6.8.10 by Gregg Pollack

This evening at Railsconf I announced the release of the Rails 3 screencasts I’ve been working on for the past few months.  Here at Railsconf Envy Labs ran a three hour Rails 3 tutorial (which received fantastic feedback).  These screencasts basically cover the same content we presented in the tutorial (without the labs).

There are six different videos which are all published on the official RubyOnRails.org website.  There’s a two minute Introduction video,  Getting Started & Action DispatchBundler & Action MailerActive Relation & Active Model,  Cross-site scripting & Unobtrusive JSThe New Action Controller.  Here’s the introduction video to get your appetite wet.

Railsconf Rails 3 Tutorials

5.12.10 by Gregg Pollack


RailsConf 2010
Railsconf 2010 is June 7th-10th in Baltimore, Maryland and almost all of the Envy Labs development team will be in attendance.  On the first day of the conference our team will be teaching a 3 hour Rails 3 Ropes Course Tutorial, and our friend Jeremy McAnally will be doing a Rails 3 Deep Dive Tutorial.

A few people were concerned about the differences between these two Rails 3 tutorials, so I got together with Jeremy and made sure there was no overlapping content.  While the Ropes course focuses more on the basics of the external API (the common front-end code), Jeremy’s talk focuses more on the internal API (the back-end code).  See below for more details:

Rails 3 Ropes Course

The Envy Labs team will be running this 3 hour course in a workshop format, containing 5 sections with ~10 minutes of instructional slides followed by 20 minutes of a code challenge where you’ll get your hands dirty programming a Rails 3 application.  In each code challenge you’ll have a set number of tasks to accomplish (and tests to make pass), along with extra credit tasks for the over achievers.  Here are the different topics we’ll be covering, and what you’ll be coding.

1. Getting Started and Routes – New script commands, configuration changes, and the new routing syntax.

2. Bundler and ActionController – The new Responds with syntax, and why and how of bundler.

3. Learning the new Mailer – The new syntax improvements in ActionMailer.

4. ActiveRelation & ActiveModel – The differences between Rails 2 and Rails 3 queries using arel, and using ActiveModel to construct non-database models.

5. XSS & UJS – How Rails 3 changed to combat cross-site scripting (XSS) and how it encourages unobtrusive javascript (UJS) through the use of HTML5 data-tags.

With a break in the middle and time for questions that’ll just about cover it.  By the end of the tutorial you’ll have built a Rails 3 application leveraging all the newest external APIs that just about everyone will be using to build Rails apps.  If you’d like to learn about the new Rails 3 internal APIs , that’s where Jeremy’s tutorial comes in.

The Rails 3 Deep Dive

The Rails 3 Deep Dive will also be a lab-driven workshop format.  The content will be cut into bite-sized chunks, each with an accompanying lab exercise to really flex those new Rails 3 chops.  In general, we’ll focus on 4 areas:

1. Rack and Rails 3 – We’ve heard a lot about Rack and Rails 3, but how is its role different now?  How deep does it integrate?  How can I get it working for me?  We’ll answer these questions and more as we look at the plethora of ways Rack can make your app faster and easier to develop.

2. Building plugins the right way – The plugin API is a lot different in Rails 3 (so much so that many popular plugins simply don’t work yet!).  We’ll spend a lot of time looking at building Railties, tying into Active Record, generating files with the new Rails generators, and more.

3. Abusing modularity – In this module (ha ha!), we’ll look at how to exploit Rails new modularity in fun and interesting ways.  We’ll build a new router, build an app without a single real controller, and other fun things that while seemingly just hacks, can actually be really useful in the right contexts.

4. What you can learn about Ruby from Rails 3 – We’ll take a tour through some Ruby techniques used inside of Rails 3 that you can either (a) jack to use in your own applications or (b) pick up some really great ideas from.

We’ll take a break after each module to decompress, compare notes, and, of course, eat some snacks.

Census: Rails Demographics Collection

4.16.10 by Mark Kendall

Much like the United States government, your Rails application may need to collect demographics data for each of its users. That’s where the Census gem comes in. It’s a Rails engine that provides:

  • an administration interface for defining the data you’d like to collect
  • extensions on your User model and forms for collecting users’ responses
  • a simple way to search for users based on their responses

In this post, we’ll take a look at Census by extending a simple Rails app to include a user satisfaction survey.

Read the rest of this entry »

Are You the Keymaster?

4.15.10 by Nathaniel Bibler

Back at FOWA Miami, Thomas Meeks and I found ourselves hopped up on Cuban coffee in the early hours of the morning.  Feeling thoroughly anti-social – and really, who wants to see a nerd at 4am – we decided to finally sit down and solve a problem that had been lingering around the office for a while.  How do we efficiently manage user accounts for all of our employees across all of our clients’ servers?  And, should something happen, how do we easily revoke those privileges if and when the time comes?

Read the rest of this entry »

Twongo Website & Screencast

4.12.10 by Gregg Pollack

In early December we were approached by a startup in Raleigh that wanted to develop daily coupon website on a rapid schedule. We looked at our team’s resources, the short time frame, and decided to give it our best try.

A little over a month later Twongo.com was launched, a strong competitor in the growing group buying world. The Twongo back-end is written in Ruby on Rails, leverages Mad Mimi for all emailing, and is hosted on the Engine Yard Cloud. Not only did we do all the development for Twongo, but we also created two simple screencasts to help people learn about the service. Here’s the first screencast below:

Here’s the second screencast about the checkout process (if you want to see more).

Right now you can find active deals in Raleigh/Durham and Dallas, with plans to move to more cities in the next few months. If there’s not yet a deal in your city, feel free to either sign up for the mailing list, or suggest that your city be added.

Rails Envy

4.7.10 by Gregg Pollack

If you go to RailsEnvy.com right now you’ll notice that it’s been completely removed, without a trace. Rails Envy taught me a great deal over the past year. It was a wild ride which only recently came to a close and it deserves one last article to share what it was, and how it got to where it is now.

At the beginning of 2006 I started up Orlando’s Ruby Group, and towards the end of 2006 we had a few Hackfests. During one of these hackfests I managed to pair up with Jason Seifer, who was at the same level as I was with regards to Ruby and programming in general. He told me how he was only programming in his spare time, but would love to do it full time.  I was running a little consultancy named Patched Software, and just reached the point where I could use some help so I hired Jason for something around $25/hour. That sounds low, but at the time I was charging my clients $35/hour. I was new to Ruby and  the consulting business in general so I took what work I could get.

Read the rest of this entry »

What’s new in Rails 3.0 Beta 2

4.6.10 by Jacob Swanner

On April 1st, Rails 3.0 Beta 2 was released, I thought I’d take this opportunity to highlight some of the changes between the Beta 1 and Beta 2 releases.  According to GitHub, there are 2,691 new, unique commits — contributed by 244 authors — that were included in the Beta 2 release.  I’ve picked some of the changes that I felt were important from the perspective of someone using Rails to build a web application and those that build plugins and other extensions for Rails.

The changes are separated by each of Rails’ individual components:

ActionMailer

You can now register interceptors and observers that will be called before and after an email is sent, respectively.  The interceptor object must implement the delivering_email method, while the observer object must implement delivered_email. Here’s a simple example:

class MyInterceptor
  def self.delivering_email(mail)
    # do something before sending the email
  end
end

class MyObserver
  def self.delivered_email(mail)
    # do something after sending the email
  end
end

ActionMailer::Base.register_interceptor(MyInterceptor)
ActionMailer::Base.register_observer(MyObserver)

ActionPack

Block helpers now return Strings, so you can use <%= form_for @foo do |f| %>. <% form_for @foo do |f| %> still works but will give you a deprecation notice.

The way that send_file works has changed, it now defers to a Rack middleware called Rack::Sendfile. With that, the following options have been removed from send_file: :stream, :buffer_size, and :x_sendfile. The header used to send the file is configurable via config.action_dispatch.x_sendfile_header — which defaults to “X-Sendfile” — , and servers can configure this setting as well by setting the “X-Sendfile-Type” header. Hopefully, hosting companies specializing in Rails deployments will set this header, so that it will work transparently for those deploying there. If you do need to set it manually, for say Lighttpd, here’s an example:

class MyApp < Rails::Application
  config.action_dispatch.x_sendfile_header = 'X-Lighttpd-Send-File'
end

ActiveModel

For those creating libraries that they want to conform with ActiveModel, there has been some changes to ActiveModel::Lint — a module of tests that you can include in your tests to ensure your library conforms to ActiveModel. #new_record? and #destroyed? were removed, use #persisted? instead. For those of you that are curious, ActiveRecord’s implementation of persisted? is as follows: A model is persisted if it’s not a new_record? and it was not destroyed?.

In addition, #to_key was added to ActiveModel::Lint, this is used to generate DOM IDs for ActiveModel objects.

ActiveRecord

You can now prefix the table names all of the models in a module, you just need to define self.table_name_prefix on the module:

module Prefixed
  def self.table_name_prefix
    'prefixed_'
  end

  class ModelName < ActiveRecord::Base
  end
end

ActiveSupport

There are new assertions you can use in your tests: assert_blank and assert_present. Here they are used in a simple example:

assert_blank [] # => true
assert_present {:data => 'x' } # => true

yajl-ruby was added as a JSON parsing backend; and is the preferred backend, if available. There was an interesting discussion about using ActiveSupport::JSON.encode over #to_json on the patch’s Lighthouse ticket.

Session store configuration has changed. The cookie_verifier_secret has been deprecated and it is now assigned through Rails.application.config.cookie_secret instead and moved into it’s own file: initializers/cookie_verification_secret.rb. Also, session_store configuration has also been changed from ActionController::Base.session to Rails.application.config.session_store and has been moved to initializers/session_store.rb.

If you were building a plugin that inherited from Rails::Railtie, you were probably setting railtie_name and/or engine_name, well both of them have been deprecated. You can now add any object to the configuration object: config.your_plugin = {}. To see how the Rails internals switched to this new configuration approach, view the commit.

Upcoming Conferences

3.30.10 by Gregg Pollack

Envy Labs will be in attendance at a bunch of conferences coming up in the next few months. If you happen to be there definitely stop and say hello! We love to meet other people that are as passionate about development as we are.

April 9-10
Ruby Nation in Reston, VA

I (Gregg) will be doing a talk on “Decyphering Yehuda”, where I’ll take a deeper look at some of the programming techniques used in the refactoring of Rails in the past year, and how you might use them in your own project.

April 25
RubyConf Taiwan in Taipei, Taiwan

I’ll also be doing my talk on “Deciphering Yehuda” here.  Looking forward to meeting up with Ruby developers across the Pacific Ocean for the first time.

May 6-7
Red Dirt RubyConf in Oklahoma City, OK

Jacob Swanner and I will be presenting our Rails 3 ropes course for the first time, a 3 hour workshop where attendees go hands on with some of the most exciting parts of Rails 3.  I’ll also be doing speaker interviews and a live recording of Ruby5.  That should prove to be quite interesting.

June 7-10
RailsConf in Baltimore, MD

The entire Envy Labs development team: Thomas Meeks, Nathaniel Bibler, Jacob Swanner, Mark Kendall, Caike Souza, Tyler Hunt, and I will be teaching the Rails 3 ropes course together.  I’ll also be there to present the Ruby Hero Awards.

July 19-23
OSCON in Portland, Oregon

Thomas Meeks, Nathaniel Bibler, Jacob Swanner, and I will be doing the Rails 3 ropes course one more time for the west coast crowd.

That’s about all for now. If you’re interested in having us come out to your event to do a talk or even into your development team to do a little Rails 3 training feel free to get in touch.

Blue Light Special

3.19.10 by Mark Kendall

At Envy Labs, we start most projects by setting up a user authentication system. We like ThoughtBot’s Clearance gem for its simplicity, but we’ve found that we often end up adding a common set of additional features on top of what Clearance provides.

So today we’re announcing the public release of our modified version of Clearance, which we’re calling Blue Light Special. In addition to its user authentication system, Blue Light Special provides a simple role system with built-in support for admin users, the ability for an admin to impersonate other users, and starting points for your application layout and administration interface.

Read the rest of this entry »

BarCamp Orlando

2.22.10 by Gregg Pollack

BarCamp Orlando is happening April 3rd, 2010 and Envy Labs is proud to be a sponsor this year. If you’re in the Orlando area we highly recommend you register for the event and participate in one of Orlando’s best tech events. Here’s a quick video to learn more about the event.

View On YouTube