Skip to content

Instantly share code, notes, and snippets.

@hueyl77
Last active December 14, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hueyl77/5109750 to your computer and use it in GitHub Desktop.
Save hueyl77/5109750 to your computer and use it in GitHub Desktop.
Mailgun AuthenticatedController sample
class Courses::PostsController < AuthenticatedController
expose(:course)
expose(:posts) { course.posts }
expose(:post)
def create
post.user = current_user
post.save
CourseNotifier.new(course).notify_course_participants_on_new_discussion(post)
redirect_to course_home_path(course)
end
...
end
class Courses::Posts::CommentsController < AuthenticatedController
expose(:course)
expose(:posts) { course.posts }
expose(:post)
expose(:comments) { post.comments }
expose(:comment)
def create
comment.user = current_user
comment.save
CourseNotifier.new(course).notify_course_participants_on_new_discussion(comment)
redirect_to course_home_path(course)
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment