1. If I generate members model, then members table will be created in the database
2. If I generate recovery model, then recovery "-----------------"---------------------------".
3. And there is no association or any type of relation(one to many, has-many, belongs-to) between these two tables.
Now is it possible to access data of members table such as member_code, member_status (active or inactive) etc from recovery model?
If possible how?
1. I have members model and the table with so many attributes but right now I'm interested in member_code and member_status.
2. I have loan model and the table. Attributes I'm interested in are loan_type (joint loan or personal loan).
3. I have receipts table (Which contains the information of how much of the loan are already cleared by all members).
4. Now this is the special case. This model called recovery, I created it just because I read that business logic should be implemented inside the model and this model will calculate the remaining amount to be paid by each members.
May be members, loan and receipts table have association or relation between them, but in this recovery model all I want to do is just to read data from different tables and process the data and finally store them inside recovery table.
How can I achieve this ?
>Member.where(status: "active")
>will give you the members, then you can use each to get member.member_code
And I hope comma in this query will act as logical AND.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/65a6d016-b37b-48c7-adfc-e700b820086d%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuCEG1qJjXNpbf0tFWCLKMnWNrLhwv1X1YjbzeO2Lvd8A%40mail.gmail.com.