Fix url encode and rescue duration method in model

This commit is contained in:
manson 2014-07-15 17:23:50 +08:00
parent c4fdd46487
commit df97b18456
2 changed files with 8 additions and 4 deletions

View File

@ -17,7 +17,7 @@ class Admin::ExperiencesController < OrbitMemberController
@member = MemberProfile.find(experience_params['member_profile_id']) rescue nil @member = MemberProfile.find(experience_params['member_profile_id']) rescue nil
@experience = Experience.new(experience_params) @experience = Experience.new(experience_params)
@experience.save @experience.save
redirect_to '/admin/members/'+@member.to_param+'/Experience' redirect_to URI.encode('/admin/members/'+@member.to_param+'/Experience')
end end
def edit def edit
@ -30,7 +30,7 @@ class Admin::ExperiencesController < OrbitMemberController
@experience = Experience.find(params[:id]) @experience = Experience.find(params[:id])
@experience.update_attributes(experience_params) @experience.update_attributes(experience_params)
@experience.save @experience.save
redirect_to '/admin/members/'+@member.to_param+'/Experience' redirect_to URI.encode('/admin/members/'+@member.to_param+'/Experience')
end end
def destroy def destroy
@ -66,7 +66,7 @@ class Admin::ExperiencesController < OrbitMemberController
@intro = @intro.nil? ? ExperienceIntro.new({:member_profile_id=>@member.id}) : @intro @intro = @intro.nil? ? ExperienceIntro.new({:member_profile_id=>@member.id}) : @intro
@intro.update_attributes(intro_params) @intro.update_attributes(intro_params)
@intro.save @intro.save
redirect_to '/admin/members/'+@member.to_param+'/Experience' redirect_to URI.encode('/admin/members/'+@member.to_param+'/Experience')
end end
def get_settings def get_settings

View File

@ -26,7 +26,11 @@ class Experience
before_validation :add_http before_validation :add_http
def duration def duration
if !self.start_date.nil? or !self.end_date.nil?
self.start_date.strftime('%Y.%m')+' ~ '+self.end_date.strftime('%Y.%m') self.start_date.strftime('%Y.%m')+' ~ '+self.end_date.strftime('%Y.%m')
else
""
end
end end
def slug_title def slug_title