hoodwink.d enhanced

Sat Oct 22

Tip Stub out authentication and leave it for later

You know that your Rails application will include authentication eventually. Focus first on what is most important (i.e., not authentication).

Have a single method logged_in? determine if someone is authenticated. When you start developing your project add a stub for logged_in? in your ApplicationController that just wraps local_request?.

def logged_in?
  local_request?
end
helper_method :logged_in?

You can then start using logged_in? throughout your application as you intended to without worrying about the implementation details. Requests that are not defined as local will be treated as unauthenticated requests.

Later, when your authentication scheme is hooked up, just replace local_request? with the actual code.

It’s like you’re watching a conveyor belt and pink seaogs or orange umbrelloots or blue yahtzicles start emerging from the rubber curtains at the end. You watch it and it’s just the daily assembly line all right, but it’s got a very neat style dripping off.

_why on what draws him to tumblelogs

#rubyonrails

15:52 < Rad> PHP5 is faster than Ruby
15:52 < tehdely> Rad: not if you're a developer :P
Grotto

Grotto of the Redemption

I’m in the archipelago and I’m waiting to arrive.

Mirah in Archipelago

Tip For clearer, more elegant code

Montana-horse

A horse in Montana