Get ID of the object saved with association
- by Pravin
Hi, Here is my scenario:
I have three models Subscriber, Subscription, Plan, with has_many :through relationship
between Subscriber and Plans.
A subscriber can have multiple plans with one active plan. Whenever a subscriber selects a plan I save it using accepts_nested_attributes_for :subscriptions. I get one plan from the form.
Now my problem is I want to get the ID of the record created in subscriptions table.