#407 Activity Feed from Scratch pro Feb 14, 2013 | 14 minutes | Views Creating an activity feed presents some interesting challenges. Here I share my thought process behind my implementation including when to use callbacks and a few tricks with partials. Subscribe to Watch Episode Twe...
Learn how to easily add a user activity feed using the public_activity gem. Here I show both the default setup using model callbacks and a manual way to trigger activities.
The Rails API docs are very useful but can be difficult to read. This episode will give some tips on reading the docs and mention a few alternative sites for accessing the API. Update: sorry about the broken movie, it should work now.
This is a fantastic question. As I expressed in a comment below, we've been using AngularJS in production for a couple months now with huge success. However, we didn't start off using Angular--at first, we used a more "traditional" (one might say "old school") style of basic, imperati...
AngularJS is an awesome framework for easily creating rich, client-side applications. Its powerful bindings allow you to do a lot with very little code. Here I show how to integrate Angular with a Rails app.
#148 Custom App Generators (revised) Feb 03, 2013 | 10 minutes | Tools Learn how to customize the Rails app generator to fit your preference. This episode shows how to do this using .railsrc file, app templates, app builders, RailsWizard, and AppScrolls. Subscribe to Watch Episode Twe...
A useful side-effect of this is that it helps us to get a better understanding of how Rails works. For our error we can see that the check_box method is triggered in our code and working through the stack trace we’ll see that this method is called on a form builder and we can carry on...
#401 ActionController::Live pro Jan 19, 2013 | 14 minutes | Rails 4.0 , Ajax Server-sent events allow you to trigger events on the browser from a persistent connection to the server. This requires Rails stream data which can be done through ActionController::Live, a feature upcoming i...
Here we take a look at two tools to aid us in development: Better Errors which makes it easier than ever to debug exceptions, and RailsPanel, a Chrome extension to see Rails requests.
Rails 4.0 is still unfinished, but it is shaping up to become a great release. Here I show how to setup a new Rails 4.0 (edge) application and walk through many of its new features.
#403 Dynamic Forms pro Jan 27, 2013 | 14 minutes | Forms , Views Learn how to add fields to a form dynamically using another form, complete with custom field types. It's fieldception! Subscribe to Watch Episode Tweet Show Notes 2 Comments Similar Episodes < Previous Episode Subscribe ...
Here we take a look at two tools to aid us in development: Better Errors which makes it easier than ever to debug exceptions, and RailsPanel, a Chrome extension to see Rails requests.
#401 ActionController::Live pro Jan 19, 2013 | 14 minutes | Rails 4.0 , Ajax Server-sent events allow you to trigger events on the browser from a persistent connection to the server. This requires Rails stream data which can be done through ActionController::Live, a feature upcoming i...
#229 Polling for Changes (revised) Jan 14, 2013 | 10 minutes | Ajax , Performance Polling may not be as common today as pushing changes over an open socket, however it is still an effective, simple solution if you do not need instantaneous updates. Subscribe to Watch Episode Tweet Sho...
I am at the coast with my family, so there won't be episodes this week. I will be back January 14 with the regular schedule of two episodes per week. If you are a RailsCasts Pro subscriber you can extend your subscription by one week below. Thanks for subscribing! Unable to extend sub...
Hi Ryan! Do you feel that there is any discernable cost to getting started writing a new Rails 4 application now and updating it as opposed to waiting for the release? My concerns wouldn't involve many gems. I'm thinking more along the lines of application structure, features getting ...
git clone https://github.com/rails/rails.git cd rails bundle gem install bundler --pre bundle railties/bin/rails new ~/code/blog --edge -d postgresql mate ~/code/blog cd ~/code/blog rake db:create rails g scaffold article name content:text published_on:date tags properties:hstore rake...
git clone https://github.com/rails/rails.git cd rails bundle gem install bundler --pre bundle railties/bin/rails new ~/code/blog --edge -d postgresql mate ~/code/blog cd ~/code/blog rake db:create rails g scaffold article name content:text published_on:date tags properties:hstore rake...
#399 Autocomplete Search Terms pro Dec 31, 2012 | 17 minutes | Performance , Caching Learn how to add autocompletion to a search form and improve performance using Rack middleware, caching and switching from SQL to Redis. Subscribe to Watch Episode Tweet Show Notes 2 Comments Similar ...
Episode #344 – Apr 24, 2012 – 25 comments Queue Classic PostgreSQL can act as a worker queue which can replace the need for a separate process to manage the background jobs. Here you will learn how to do this with the queue_classic gem. (8 minutes) Watch Episode Read Episode Episode #...
application in development we need to start up a number of background processes beforehand. These include Beanstalkd, a script/worker process and a Faye server. We have to start up all of these every time we want to use the application in development. It would be much better if there ...
#162 Tree-Based Navigation (revised) Dec 01, 2012 | 10 minutes | Active Record , Plugins , Views If your Rails app is content-heavy, consider organizing it in a tree menu structure. Here I show how to add top-level tabs, nested links in a side bar, and breadcrumbs to go up the hierarc...
I am taking this week off for the holidays. RailsCasts will be back December 31, 2012. If you are a Pro subscriber, you can extend your subscription by one week below. Have a Merry Christmas and Happy Holidays! -- Ryan Unable to extend subscription since no current subscription was fo...
#394 STI and Polymorphic Associations pro Nov 25, 2012 | 14 minutes | Refactoring , Active Record Single Table Inheritance (STI) can help organize branching logic into separate classes, but a polymorphic association may be a better fit if there are unique database columns.
pry(#<Class:0x104e63de0>):1> show-method all.in_groups_of From: /Users/eifion/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.10/lib/active_support/core_ext/array/grouping.rb @ line 19: Number of lines: 19 def in_groups_of(number, fill_with = nil) if fill_with == false collection = s...
Models can quickly become a grab-bag of unrelated methods if behavior is constantly being pushed from the controller. Here I show how to refactor this using Concerns and Service Objects.
A model's ID in the URL is not very helpful to the user. Consider adding the name which can also improve SEO. Learn how to override to_param, add a slug attribute, and make a catch all route for deep nesting.
The first question that comes to mind is should we store the guest user account in the database if it’s just temporary? Our application is currently structured so that a user has many tasks and we use this association in the TasksController to ensure that only the current user’s tasks...
Find out exactly what Rails is doing under the hood when it renders a view template for a response. What object context handles the template? How does the lookup process work? That and more covered in this code walkthrough.