Skip to content

Instantly share code, notes, and snippets.

@jesscanady
Created March 28, 2012 17:24
Show Gist options
  • Save jesscanady/2228411 to your computer and use it in GitHub Desktop.
Save jesscanady/2228411 to your computer and use it in GitHub Desktop.
--- a/config/navigation.rb
+++ b/config/navigation.rb
@@ -77,7 +77,7 @@ SimpleNavigation::Configuration.run do |navigation|
when 'Administrator'
primary.item :users, 'Users', users_path, :highlights_on => :subpath do |users|
users.dom_class = 'nav nav-tabs users'
- if !@user.nil? and !@user.new_record?
+ if @user.present?
users.item :notes, 'Notes', user_notes_path(@user)
users.item :claims, 'Claims', user_claims_path(@user), :if => Proc.new{ @user.user_role.IsConsumer == 1 }
users.item :locations, 'Locations', user_addresses_path(@user), :if => Proc.new{ @user.user_role.IsProvider == 1 }
@@ -91,7 +91,7 @@ SimpleNavigation::Configuration.run do |navigation|
profile.dom_class = 'nav nav-tabs users'
profile.item :profile, 'Profile', profile_path
# this executes in all contexts, skip when we don't have a @user defined
- if !@user.nil?
+ if @user.present? && !@user.new_record?
profile.item :locations, 'Locations', user_addresses_path(@user)
profile.item :pictures, 'Pictures', user_pictures_path(@user)
profile.item :treatments, 'Treatments', user_treatments_path(@user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment