Created
March 16, 2022 18:04
-
-
Save ghedamat/41bd040b7e71fb279cf22fd90b3cc090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module ContinuingEducation | |
class CreditCoursesController < ApplicationController | |
rescue_from ActiveRecord::RecordNotFound do |_| | |
redirect_to 'https://precisionnutrition.com' | |
end | |
skip_authorization_check | |
def index | |
@credit_courses = ContinuingEducation::RecertificationCreditCoursePresenter.where(external: true).group_by(&:external_organization) | |
end | |
end | |
end | |
app/presenters/continuing_education/recertification_course_presenter.rb | |
module ContinuingEducation | |
class RecertificationCreditCoursePresenter < RecertificationCreditCourse | |
def foo | |
name | |
end | |
end | |
end | |
module ContinuingEducation | |
class CreditCoursesController < ApplicationController | |
rescue_from ActiveRecord::RecordNotFound do |_| | |
redirect_to 'https://precisionnutrition.com' | |
end | |
skip_authorization_check | |
def index | |
credit_courses = RecertificationCreditCoursePresenter.where(external: true) #.group_by(&:external_organization) | |
@courses = credit_courses.map {|c| RecertificationCreditCoursePresenter.new(c) }.group_by(&:external_organization) | |
end | |
end | |
end | |
module ContinuingEducation | |
class RecertificationCreditCoursePresenter | |
attr_reader :course | |
def initialize(course) | |
@course = course | |
end | |
def foo | |
course.name | |
end | |
def external_organization | |
course.external_organization | |
end | |
end | |
end | |
<% if @courses.a.empty? %> | |
<% else %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment