mercredi 22 février 2017

undefined method 'abc' for nil:NilClass

I have a method in model my_model

  def abc
    abc_mapping(column.to_s)
  end

and i am calling this method in controller

@dba = @user.method
@abc = @my_model.abc

I am calling @abc and @dba in view and it shows me the data on JSON but When i run spec i am getting error undefined method 'abc' for nil:NilClass. My unit test is verifying the data from other instance variable @dba in controller so why i am getting the error for abc method?

Aucun commentaire:

Enregistrer un commentaire