Skip to content

Instantly share code, notes, and snippets.

@ericcf
Created March 10, 2015 13:31
Show Gist options
  • Save ericcf/b0e59b109dd43b347b64 to your computer and use it in GitHub Desktop.
Save ericcf/b0e59b109dd43b347b64 to your computer and use it in GitHub Desktop.
shareable item action labels
# in host app
class Activity
def action
status_label.downcase
end
end
# in social_netoworking
class Shareable
def initialize(item)
@item = item
end
def action
@item.try(:action) || "Shared"
end
end
# in social_networking
class SharedItem
before_save :set_action_type
private
def set_action_type
self.action_type = Shareable.new(item).action
end
end
@michaelwehrley
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment