I have found a few places that have said that they don’t mix well, but I
haven’t been able to find any reasoning as to why.
Does anyone have any knowledge to why this is?
Thanks
I have found a few places that have said that they don’t mix well, but I
haven’t been able to find any reasoning as to why.
Does anyone have any knowledge to why this is?
Thanks
Chris O. wrote:
I have found a few places that have said that they don’t mix well, but I
haven’t been able to find any reasoning as to why.Does anyone have any knowledge to why this is?
It’s not that they don’t mix well - it’s fine to use habtm with RESTful
resources. It’s that you don’t get any synergy from using both of them
together, since you can’t use a habtm join table record as a resource
that can be addressed with a RESTful URL. But with has_many :through, a
URL can describe a join model record as a resource. That means you have
a noun that you can manipulate with the standard HTTP verbs. With habtm,
you have to invent custom actions to manipulate the joins, so it’s not
as easy or compatible. That’s all.
–
Josh S.
http://blog.hasmanythrough.com
Josh S. wrote:
It’s not that they don’t mix well - it’s fine to use habtm with RESTful
resources. It’s that you don’t get any synergy from using both of them
together, since you can’t use a habtm join table record as a resource
that can be addressed with a RESTful URL. But with has_many :through, a
URL can describe a join model record as a resource. That means you have
a noun that you can manipulate with the standard HTTP verbs. With habtm,
you have to invent custom actions to manipulate the joins, so it’s not
as easy or compatible. That’s all.–
Josh S.
http://blog.hasmanythrough.com
Thanks Josh, that makes sense.
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