RailsCasts Pro episodes are now free!

Learn more or hide this

Ken Hart's Profile

GitHub User: jkhart

Site: jkhart.com

Comments by Ken Hart

Avatar

Ryan,

This is fantastic, glad to see you'll be making some more money for all your hard work. I'm very happy to go pro. Quick question though, I was very excited to see how you handled your payment, subscriptions, etc. by looking at this app on github. But for some reason, it doesn't look like it's updated there. I see no routes, controllers, models, engines, or anything that builds the subscription/payment parts. How are you handling this/can we view this code?

Avatar

I had the same problem. Could not get models reload. I tried to a bunch of fixes I found from searches, but nothing worked. I eventually had to abandon spork. Sucks too cause it did speed it up a bunch.

Avatar

I really like the gem but it is extremely slow for me. Is anyone else experiencing this?

Avatar

I just set it up using RC6, it seems to be working just fine, is that not the case for you?

Avatar

As always, great railscast. But what'd I'd really like to get peoples' opinion on is how they have/will use this asset pipeline to better merge the work of designers/html coders and web developers (as I'm assuming most of you guys are).

I used to set up a "mockups" folder in "public" so the mockups and the real app pulled from the same javascript, images, and stylesheets. This really isn't possible anymore, so I've changed to teaching the designer some basic rails so he can write things like <%= asset_path 'background.png' %> in application.css.erb. Anyone have good suggestions on a better setup?

Thanks very much!

Avatar

That's what I've been doing as well. I'm giving Timecop a try now and it's pretty good, not much changed except a few tests so far.

Avatar

Ok interesting to know. I was trying to stick with that as well, but I really ran into trouble when I wanted to test redirects and urls. Maybe there's a way to do this (cleanly), but I couldn't figure it out. Say you wanted to test a very simple create action that redirects to the show page. In the integration test you have something like:

ruby
visit new_user_path
fill_in :name, :with => "Ken"
click_button "Submit"

at this point, how can you access the controller variables to ensure that you redirect to user_path(@user). assigns(:user) wasn't working, and after days of searching, came to the conclusion this sort of test is best served in the controller specs. I supposed you could do something like:

current_page.should eq(user_path(User.last))

but that didn't seem right at all.

Avatar

Excellent cast as always, and I really like the testing angle. I've got a question though and I was hoping you or anyone else could help me out. I fairly experienced in the app folder, but not quite as much in spec. But alas, I have taken on Ryan's challenge last week and haven't opened the browser since. It's been going great, and I have tons of test coverage, but I'm worried I may have too much - or at least redundant tests. Specifically, I see a lot of overlay between my integration tests and my controller tests. I find that whichever one I write first, it covers about 75% of the other one. That really bugs me. So a few things:

  1. Is this normal? I get the feeling it isn't because there really wouldn't be 2 seperate areas to test the same thing.
  2. What's some good practices to make sure that there's little overlap between the 2 sections.
  3. Do you always start with integration tests, then more to controller, or what are the common coding flows that people use.
  4. I'm very good at refactoring app code, but test code, not so much, any suggestions on how to really learn good test code refactoring?

Thanks so much everyone.

Ken

Avatar

Great episode! As a developer that mostly works in isolation, I pick up a lot of my coding style from seeing how others do this and that on the web. One of the drawbacks is that you don't have that much of an opportunity to learn about other coders' testing styles, so this is a huge help. Hopefully push me further in a direction I know I need to go. As many times as I'm allowed, I vote (and greatly appreciate) testing included in these railscasts. Thanks again man.

Avatar

Well I feel bad because I have been providing feedback that the screencasts have focused too much on gems. I like to see things from scratch, it helps become a better coder. Omniauth is a perfect example, sure you can just plug it into devise, but what if you need to use external services separate from login - most people would be stuck because they've relied so heavily on gems to do this kind of work. All I can say is we have a difference of opinion, i just wanted mine to be heard because I like a variety of screencasts, sometimes about specific code, and sometimes about gems.

Avatar

Hey thanks for that info, I'll have to do some research on this geospatial datastore

Avatar

I was under the impression that you should use a decimal data type when storing the latitude and longitude because a float isn't precise enough, what are your thoughts on this?

Avatar

Does anyone else think the app directory is getting too big to fast? I'm worried things are getting thrown in there. If you're using this technique, plus carrierwave, maybe some caching, presenters, and emails, your app directory would look like this:

assets
controllers
helpers
mailers
views
uploaders
models
sweepers
workers
presenters

Avatar

Does anyone have any good suggestions on how to use this if your html/css coder doesn't use rails? Before, we just created a folder in "public" called "mockups", which would use the same stylesheets, images, and javascripts as the app. But now, with this asset pipeline, I have to figure out a way to keep our streamlined integration. How do some of you handle this?

Avatar

Hey Ryan, would a good use-case for streaming be for a landing page like Groupon, where the background image is very large and could take some time to load? Or is it more for javascript intensive pages?

Avatar

Just watched, very excited to upgrade.

Avatar

Very impressive Ryan. Haven't watched the episode yet, but I'm sure it's great like all the rest. Thank you very much for keeping up with this every week. The new design looks really nice.

By the way, when facebook comes out with a new design, everyone hates it and complains, when you come out with one, I see nothing but praise. Thanks man!