1
votes
node(:status) { @status }
node(:message) { @message }

object @patient
attributes :medication, :guardian_id, :id, :name, :email, :username, :address, :age, :gender

node :errors do |e|
e.errors
end

I want something like this

if object is patient

do this

eleif object is doctor

do this

How to apply condition in rabl file?

1

1 Answers

1
votes

In rabl, you would just use normal Ruby for if-statements.

if [email protected]?
  # do this
elsif [email protected]?
  # do that
end

I didn't know how you intended to use your objects, just guessed. Could also be something like if object == 'patient' etc...