Skip to content

Instantly share code, notes, and snippets.

@thomasbiddle
Created July 9, 2013 23:41
Show Gist options
  • Save thomasbiddle/5962300 to your computer and use it in GitHub Desktop.
Save thomasbiddle/5962300 to your computer and use it in GitHub Desktop.
# Using friendly IDs to translate the name in the route to the ID.
project_name = params[:id].to_s
if Project.where('name like ?', project_name).empty?
@project = Project.new
@project.name = project_name
notify("info", "Project does not exist - Create one!")
return render :action => 'new'
else
@project = Project.where('name like ?', project_name).first
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment