Is it valid to include view code in Model?
- by Shreekumar S
Guys I'm new to RoR and MVC.
I've a model which deals with loan beneficiary's data. To access the structured data (including small piece of HTML data) I created a method like this
class Beneficiary < ActiveRecord::Base
def info
"#{name}</br>#{age},#{sex}</br><b>Address :</b>#{address}"
end
end
And in the view, I'm using this info something like this
<%= @b.info.html_safe %>
were, b is an instance of Beneficiary class
It's working fine for me. I just want to know that, Am i violating the MVC rule here? Is it valid to include view code in Model?