Skip to content

Instantly share code, notes, and snippets.

@rramsden
Created February 8, 2011 23:38
Show Gist options
  • Save rramsden/817534 to your computer and use it in GitHub Desktop.
Save rramsden/817534 to your computer and use it in GitHub Desktop.
class Website < ActiveRecord::Base
has_many :redirects
end
class Redirect < ActiveRecord::Base
def self.factory_build(attributes)
# how do i access the primary_key of my Website
# when I call @website.redirects.factory_build(...)
end
end
class TemporaryRedirect < Redirect
def status
302
end
end
class PermenantRedirect < Redirect
def status
301
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment