Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mathias/5242430 to your computer and use it in GitHub Desktop.
Save mathias/5242430 to your computer and use it in GitHub Desktop.
# lib/decent_exposure/draper_strong_parameters_strategy.rb:
class DraperStrongParametersStrategy < DecentExposure::StrongParametersStrategy
def resource
super.decorate
end
end
# app/controllers/articles.rb
class ArticlesController < ApplicationController
expose(:articles)
expose(:article, attributes: :article_params)
private
def article_params
params.require(:article).permit(:original_url, :read)
end
end

Projects that I had issues with on Rails 4 + Ruby 2:

  • papertrail
  • thoughtbot/high_voltage (might be fixed?)
  • decent_exposure -- fixed!
  • ledermann/unread -- fixed!
  • decent_exposure WITH draper (see slide 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment