Hi, I am also facing the same problem. Unfortunately googling around,
I see recommendations of using the method find_or_create_by. But what
if I'm using nested attributes to save?
Any advise?
On Feb 24, 1:56 pm, Butu <
but...@gmail.com> wrote:
> Hi,
>
> Song
> has_and_belongs_to_many :people
> accepts_nested_attributes_for :people
>
> Person
> validates :uniqueness => true
>
> If person record not present, nested attributes working great! in rails way.
> i.e., inserting into songs, people and people_songs table correctly.
>
> I am interested in:-
> *If there is person exist, it should skip insertion into people table but
> data should be inserted in songs and people_songs table (association
> table). *
> *
> *