class Admin::CertificatesController < OrbitMemberController def index @certificates = Certificate.order_by(:created_at=>'desc').page(params[:page]).per(10) end def new @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil @certificate = Certificate.new end def create certificate = Certificate.create(certificate_params) redirect_to params[:referer_url] end def edit @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil @certificate = Certificate.find(params[:id]) end def frontend_setting @member = MemberProfile.find_by(:uid=>params['uid']) rescue nil @intro = CertificateIntro.find_by(:member_profile_id=>@member.id) rescue nil @intro = @intro.nil? ? CertificateIntro.new({:member_profile_id=>@member.id}) : @intro end private def certificate_params params.require(:certificate).permit! end end