We're not adding the rule because it would apply the current line length rule of 110 characters per line. We still haven't decided whether we'll keep that rule or make lines shorter so they're easier to read, particularly when vertically splitting the editor window. So, for now, I'm applying the rule to lines which are about 90 characters long.
28 lines
764 B
Ruby
28 lines
764 B
Ruby
module FollowablesHelper
|
|
def followable_type_title(followable_type)
|
|
t("activerecord.models.#{followable_type.underscore}.other")
|
|
end
|
|
|
|
def followable_icon(followable)
|
|
{ proposals: "Proposal", budget: "Budget::Investment" }.invert[followable]
|
|
end
|
|
|
|
def render_follow(follow)
|
|
return unless follow.followable.present?
|
|
|
|
followable = follow.followable
|
|
partial = "#{followable_class_name(followable)}_follow"
|
|
locals = { followable_class_name(followable).to_sym => followable }
|
|
|
|
render partial, locals
|
|
end
|
|
|
|
def followable_class_name(followable)
|
|
followable.class.to_s.parameterize(separator: "_")
|
|
end
|
|
|
|
def find_or_build_follow(user, followable)
|
|
Follow.find_or_initialize_by(user: user, followable: followable)
|
|
end
|
|
end
|