Hi there,
Just a simple question I guess, but I am unable to find an anwser…
How to delete a hmabtm relation?
Any help will be appreciated
Thanks,
Fabrice.
Hi there,
Just a simple question I guess, but I am unable to find an anwser…
How to delete a hmabtm relation?
Any help will be appreciated
Thanks,
Fabrice.
Fab wrote:
Hi there,
Just a simple question I guess, but I am unable to find an anwser…
How to delete a hmabtm relation?
Any help will be appreciated
Thanks,
Fabrice.
Try this…
@user = User.find(session[:current_user])
@tag = Tag.find(params[:tag_id])
@tag.users.delete(@user)
where Tag habtm User
I’m pretty sure that you need to pass the actual @user object, not just
the id,
can’t quite remember…
Hope it helps :]
ciao
Gustav P.
[email protected]
itsdEx.com
Hi Gustav,
It works perfectly
Thanks a lot for your so quick answer.
Best regards,
Fabrice.
gustav Paul wrote:
Fab wrote:
Hi there,
Just a simple question I guess, but I am unable to find an anwser…
How to delete a hmabtm relation?
Any help will be appreciated
Thanks,
Fabrice.Try this…
@user = User.find(session[:current_user])
@tag = Tag.find(params[:tag_id])
@tag.users.delete(@user)where Tag habtm User
I’m pretty sure that you need to pass the actual @user object, not just
the id,
can’t quite remember…Hope it helps :]
ciao
Gustav P.
[email protected]
itsdEx.com
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs