怕看不懂,定义几个常量

This commit is contained in:
yanxd 2014-01-20 20:56:37 +08:00
parent d202c84b44
commit b269502de2
2 changed files with 5 additions and 1 deletions

View File

@ -9,6 +9,10 @@
class UserExtensions < ActiveRecord::Base class UserExtensions < ActiveRecord::Base
belongs_to :user belongs_to :user
attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id
TEACHER = 0
STUDENT = 1
ENTERPRISE = 2
DEVELOPER = 3
#this method was used to update the table user_extensions #this method was used to update the table user_extensions
def update_user_extensions(birthday=nil,brief_introduction=nil, def update_user_extensions(birthday=nil,brief_introduction=nil,
gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil) gender=nil,location=nil,occupation=nil,work_experience=nil,zip_code=nil)

View File

@ -12,7 +12,7 @@
<%=link_to_user(User.current)%> <%=link_to_user(User.current)%>
<ul class="sub_menu"> <ul class="sub_menu">
<% if User.current.user_extensions && [0,1].include?(User.current.user_extensions.identity) -%> <% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<li><%=link_to l(:label_my_course), user_courses_user_path(User.current), target:'my_path' %></li> <li><%=link_to l(:label_my_course), user_courses_user_path(User.current), target:'my_path' %></li>
<% end -%> <% end -%>
<li><%=link_to l(:label_my_projects), user_projects_user_path(User.current), target:'my_path' %></li> <li><%=link_to l(:label_my_projects), user_projects_user_path(User.current), target:'my_path' %></li>