af83/chouette-core

View on GitHub
app/views/autocomplete/base.rabl

Summary

Maintainability
Test Coverage
collection @collection

node do |object|
  label_method = begin
    if locals[:label_method].is_a?(Symbol)
      Proc.new { |o| o.send(locals[:label_method]) }
    elsif locals[:label_method].is_a?(Proc)
      locals[:label_method]
    end
  end

  {
    id: object.id,
    text: label_method.call(object)
  }
end