fabrik42/acts_as_api — Issue #58: Obscure error when templates not defined in dependency order
Author: aliix
Created: 2012-01-29 20:59:33+00:00
State: open

E.g.

api_accessible :private, :extend => :public do
end

api_accessible :public do
end

This gives an unhelpful:

can't convert nil into Hash error in a different place.

Suggest this:

def api_accessible_attributes(api_template)
begin send "api_accessible_#{api_template}".to_sym rescue nil end
end

detect and print warnings if method is not defined.