Skip to content

Instantly share code, notes, and snippets.

@jah2488
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save jah2488/0cde4d154e382204f612 to your computer and use it in GitHub Desktop.

Select an option

Save jah2488/0cde4d154e382204f612 to your computer and use it in GitHub Desktop.
class ClubInfoContents
def initialize(club)
@club = club
end
def title
return "Congratulations! #{@club.name}" if @club.valid_member_count?
return @club.name
end
def notice
if @club.valid_member_count?
''
else
"You haven't met the member requirements."
end
end
def body
->(view_context) { view_context.render partial: 'club_info', locals: { club: @club } }
end
end
<%= @club_view.title %>
<%= @club_view.notice %>
<%= @club_view.body.call(self) %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment