Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Richard's Profile

GitHub User: rceee

Site: https://github.com/rceee

Comments by Richard

Avatar

After watching this Railscast and researching a bunch of other articles online, I figured out a way to do it with all of the upsides and none of the downsides–you get a pretty URL with both ID and name, parameterized, fully functional in controllers/views, without having to add a slug field to the database or anywhere else. Pretty efficient, I think. This is it if anyone is interested:

https://gist.github.com/rceee/5021916

Avatar

Outstanding overview of SASS. And thanks for the color wheel popup tip in TextMate; I didn't even know about that!

Avatar

Great Railscast, though I felt Rails Composer was sorely missing; seems like it's becoming the de-facto solution for this kind of thing.

Avatar

Is there a good way to prevent an user from adding (following) a friend more than once?

EDIT: This will do it:

ruby
<%= if 
    current_user.friendships.where(:friend_id => user.id).where(:user_id => current_user.id).empty? 
    link_to "Add Friend", friendships_path(:friend_id => user.id), :method => :post 
    end %>
Avatar

This is an outstanding episode! So concise and helpful.

Just one question... One small JQuery-related thing through me for a loop.

in /app/assets/javascripts/subscriptions.js.coffee, why was the change made to:

$('#new_subscription')[0].submit()

?

What is the [0] for? I have not seen that before.

Avatar

Kind of a noob question here, but when Ryan moves the javascript into $(function() { }, why does this fix that issue? Would using the standard $(document).ready() not do the same thing?

Avatar

Thank you so much. Basics for some, perhaps, but I such a solid and great explanation, this was very helpful.

I also appreciate your using regular JavaScript/JQuery for the example, rather than CoffeeScript; the sleep() tip is nice as well :]

Kudos for this!