I'm using RABL in a Rails app to access data via REST. It's working except for the if statement.
I get this error:
undefined local variable or method `matitem_id'
This is my show.json.rabl code:
object @expense
attributes :id, :unitcost, :quantity, :markup, :exp_date, :created_at, :description, :pcard, :invoice
child :employee do
attributes :id, :maxname
end
child :vendor do
attributes :id, :vendor_name
end
if matitem_id != nil
child :matitem do |matitem|
attributes :id, :itemnum
end
end
UPDATE1
I also tried
if @expense.matitem_id != nil