I have a module that returns an array:
module Module1
class Class1
def self.get
num << 1
return num
end
end
end
But when I call it from the controller like this:
def index
@trans = Module1::Class1.get()
respond_to do |format|
format.html # index.html.erb
format.json { render @trans }
end
end
Show me the following error:
'1' is not an ActiveModel-compatible object that returns a valid partial path.
But if I do in json:
def index
respond_to do |format|
format.html # index.html.erb
format.json { render Module1::Class1.get() }
end
end
It returns the right result, what am I doing wrong in the first example?
Try this