RailsCasts Pro episodes are now free!

Learn more or hide this

Dave Gerton's Profile

GitHub User: IamNaN

Comments by Dave Gerton

Avatar

For people following along with the code in this Railscast, the curl command has changed. Github redirects the 'raw.github.com' to 'raw.githubusercontent.com' now but the curl command doesn't follow the redirect.

curl https://raw.githubusercontent.com/janl/mustache.js/master/mustache.js > vendor/assets/javascripts/mustache.js

Or if you don't trust me (you shouldn't), then tell curl to follow redirects with the -L option and use Ryan's curl command instead:

curl -L https://raw.github.com/janl/mustache.js/master/mustache.js > vendor/assets/javascripts/mustache.js
Avatar

I've done this. I was having difficult getting templates to work, probably with haml, I don't really know, but the solution wasn't difficult once you realize there's no magic happening in the tmpl function.

In place of data.context = $(tmpl("template-upload", file)) pass file to your own function that marks up some html and set it to data.context. i.e. data.context = createNewStatusbarElement(file).

That function can build up the html element for the status bar from hardcoded html in strings, jquery methods, handlebars templates, or - as I've done - by cloning a hidden element (basically a poor-man's template).

Avatar

If you have problems with url helpers while running zeus, I could be wrong but believe it's because of this here.

I applaud that effort to optimize time, but like spork, I've kicked zeus to the curb. They make the test environment just a little too dissimilar from the production and development environments. I wind up spending a lot of time tracking down bugs in my code... or my tests... only to learn it's neither; it's my testing environment flaking out. So how much time is it really saving? (BIG fan of guard, though.)

YMMV

Avatar

If you are interested in getting private_pub running on Heroku, consider heroku_private_pub on Github. Just configure and push it. And the readme includes some handy debugging tips at the end.

Avatar

hiredis failed to build during bundle so I updated rails to 3.2.8 (current at this time). Problem solved.

But then Faye crashed with "undefined method `close_connection_after_writing'" anytime it was messaged. The solution was to add:

Faye::WebSocket.load_adapter('thin')

to private_pub.ru before the PrivatePub.load_config line. This answer came from Issue #39 which claims to be fixed in the private_pub gem. That's probably true, but the source for this example project was built before that change.

@denispeplin mentions this above via the complimentary Faye issue #128.

Avatar

Taps stopped working with Rails 3.2.5 for some reason, so I thought I'd finally give Valkyrie a try.

Whoa! Nice. Easier than I expected, although it's significantly slower pushing local data to my remote postgre db server on Linode.

Avatar

I get this itchy feeling any time the model has to know what the controller is doing. Validation of the sort needed to get the field validation working always seem kind of hacky to me. I know there's been a few debates, but I tend to favor the side that saying validation should be moved to the controller because it already hooked into things like context and state (i.e. authorization).

(This does not mean this wasn't another great Railscast.)

Avatar

It's okay to start using the search_field_tag now. You'll get some benefits from mobile browsers and the correct styling in most desktops.

We also can start using phone_ and telephone_, number_, url_ and email_ helpers. On mobile device, for instance, these helpers queue the browser to pop up the correct virtual keyboard for the context.

Avatar

+1 I just found this out myself and came here to see if anyone mentioned it. It's too bad the RVM site doesn't have a wiki. It's closed nature is beginning to be a sore point for me, especially because it seems to have quite a few gaps since Lion. I almost switched to RBEnv over this.

Avatar

A couple of tweaks to the show notes. Lemme preface this with I'm on rvm 1.6.9 and ruby 1.9.2-p180.

The first show note command makes use of an "undocumented feature" of rvm by switching to the gemset after it gets created. It might be better to get into the habit of using the documented way, with the "use" command:

rvm use 1.9.2@railspre --create

Next, I was getting rails-3.0.7.rc2 instead of rails-3.1.0.beta1 (can anyone explain why?). I tried explicitly asking for the 3.1.0.beta1 version with the -v option but that got me 3.0.0.beta2. However, I fixed that by updating the gems with the --pre option:

gem update --pre

Of course, this is overkill. Not sure why that worked but the gem install rails --pre didn't.