Skip to content

Api changes in version 3

Nick Palaniuk edited this page May 9, 2016 · 29 revisions

-v 2.x

expose(name, options={}, &block)
  • Possible options
:ancestor
another exposure to scope from
:model
model to use for that exposure
:params
method to call on the controller to get a params hash
:finder
method used to find the record
:finder_parameter
attribute containing the finder method's unique identifier

-v 3.x

  • Use :from in place of :ancestor
  • Use :build_params in place of :params
  • Use :id instead of :finder_parameter

Instead of using :finder and :finder_parameter like this:

class PeopleController < ApplicationController
  expose(:people, finder: :find_by_slug, finder_parameter: :slug)
end

This is now equivalent to:

class PeopleController < ApplicationController
  expose :thing, find_by: :slug
end