Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Paul Springett's Profile

GitHub User: paulspringett

Site: http://www.paulspringett.name

Comments by Paul Springett

Avatar

You might be interested in this gem I made called CSV shaper that allows you to create CSV output using a really nice Ruby DSL.

https://github.com/paulspringett/csv_shaper

Avatar

Thanks for another great episode Ryan!

What would your thoughts on using decorators to show/hide certain information based on the current user's permissions (eg. with CanCan) - by doing something like:

ruby
if can? :read, model
  h.link_to model.email, "mailto:#{model.email}"
else
  content_tag :p, "Not listed", :class => "none"
end

within the decorator? A use case might be a member directory where non-members can only see members name but logged-in members can see each others email addresses.

Maybe it's a bit of an edge case? Do you think it would appropriate to put authorisation logic in a decorator?