RailsCasts Pro episodes are now free!

Learn more or hide this

Kieran P's Profile

This user is a moderator.

GitHub User: KieranP

Site: http://k776.tumblr.com/

Comments by Kieran P


I implemented an activity feed last year which was a bit more complex than this. It had to store data such as specific actions like updating a models state column (from/to), as well as displaying consecutive activity grouped by the person who did it, and grouping the same consecutive action by the same person as "XX updated XXX (4 times)". Would be nice to see another pro episode that handled this display related stuff, since my code is kind of messy, and it's be cool to see how it might be implemented by someone else.


Wow. That's nice and clean. In this case though, it's a fairly simple example. Recently, I needed a hidden field with the id of the record, and a visible field with the name of the record (for a accepts_nested_attributes_for population). Custom JS and HTML I found was a bit more flexible.

I made a 'search' action on the Users controller, which implements the search and rendering of HTML, rather than JSON. I prefer this way because:

  • It doesn't add complexity to the index method (contained functionality, esp since index uses a simple User.all, while search needs something more complex (for fulltext or sphinx or other things like that)
  • Rendering a properly classed HTML ul element and inserting that into the page I find gives much better style control. You can add things like image into it as well.

I prefer rendering HTML from an existing partial, than having to recreate that partial in Javascript and render it that way.


I've been using Vagrant since it's very beginning. Helped it's author test the early versions and contributed to it's underlining 'virtualbox' gem. A brilliant tool! Thanks for making making a screencast about it.

Personally I setup the environment and repackage it rather than using Chef (because Chef can take a while depending on your internet connection).

Also, you can create custom plugins to help you save time. Things like 'vagrant rails_server', which could load up the box, start up all background servers, and load the rails application server, all in one command. It will speed up development.


There is a special pro feed you need to subscribe to.

Go to http://railscasts.com/pro , click "Manage you subscription" and then click "RSS Feed" (follow the instructions there to add the feed to iTunes)


Instance variables in models are also lost because each request is basically a blank slate.

The only thing to persist through requests are class variables, however, they too get lost when the server is shut down (or in the case of Phusion Passenger, the worker goes idle and gets removed).

To overcome these issues, use an external caching system. Rails has support for a few, like memcached.


I see it's referred to inside the episode, so I've also added a link to the show notes. Thanks.


#249 deals with ActiveSupport Notification subscriptions, which this episode uses to catch exceptions.

#149 is relevant though, so I've added a link to it. Thanks.


Interesting. I wonder why Rails is able to load assets and initializers and such, but not able to pick up the migrations... one would think it could just append the migration path to the list of places to search for and run from.


FAYE_TOKEN isn't in the source javascript. It's a token used on two backend servers which communicate between each other. The end user never sees, sends or intercepts that communication.


That should be fixed now. Ryan pushed the fix for it, and seeing as those buttons for me are gone now, he must have deployed the fix too.


Lol, ironic that Guard can't reload it's own config.