Sign in through GitHub

Stephen Hunter's Profile

GitHub User: Arcolye

Comments by Stephen Hunter

Avatar

Might be a basic Rails question but:

In
@activities = PublicActivity::Activity.order("created_at desc").where(owner_id: current_user.friend_ids, owner_type: "User")
where did current_user.friend_ids come from?

friend_id is an attribute of Friendship, not User, right? And you can just pluralize an attribute to get an array?

Avatar

Sorry, but you just blew my mind with Page.find_each(&:save)
I knew about find_each for batch loading, but what the heck is &:save and where else can I use it?
I mean, obviously I can see what it's doing, but can I use this anywhere a block is expected? When can't you use this notation?

Avatar

I was wondering when someone was going to mention that, and how much weight should be given to the author's advice...

Avatar

I was wondering when someone was going to mention that, and how much weight should be given to the author's advice...