Hello all, I referred the rails guides from documentation section, but I cannot solve this problem.
I have member and receipt model (which should have corresponding members and receipts table).
Now I created a model called recovery to write some business logic. (logic must be in models right?)
And I have not created any association between any of the models.
What I want to do:
I just want to retrieve all the member_code from members table whose ‘status’ is “active” from within recovery model.
Once all member_code are available I want to compare those member_code with the member_code of receipts table. If those member_code exists in receipts table, I’ll run some business logic only on those members.
So all I want to do is access the attributes of members and receipts table from recovery model and I have created a button “start recovery process” in view.html.erb of recoveries. I would like to execute the business logic written inside recovery model once I press this button.
How can I point the button to the code inside model? Because by default it will pointing to actions inside controller right?
Can I do this without creating associations? Or is it compulsory?
Please help me