Skip to content

Instantly share code, notes, and snippets.

@pyrat
Created February 20, 2010 20:43
Show Gist options
  • Save pyrat/309896 to your computer and use it in GitHub Desktop.
Save pyrat/309896 to your computer and use it in GitHub Desktop.
def get_artist
Artist.find params[:artist_id]
end
def get_label
Label.find params[:label_id]
end
def parent_object
if params[:artist_id]
@parent = get_artist
@mode = 'artist'
elsif params[:label_id]
@parent = get_label
@mode = 'label'
else
raise StandardError, "Unable to get parent object."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment