Displaying 6 results from an estimated 6 matches for "has_and_belongs_to".
2007 Jan 25
1
has_and_belongs_to won't delete records
Hi,
I have a has_and_belongs_to relationship between 2 objects, order and
product. I''m getting a foreign key violation when trying to delete
Order. Is there a special way of deleting orders without deleting
products? ("has_many" has :dependant => :delete_all.... does
"has_and_belongs_to" have som...
2010 May 31
2
has_many and has_and_belongs_to conflit
Hi,
I have 2 models: User and Article.
I have this relationship:
* User has many articles (and Article belongs to user)
* User has and belongs to many articles (and Article habtm users)
But this is tricky because of: current_user.articles ...this can return
articles thanks to *has_many* and *has_and_belongs_to* relations. So
there''s a collision.
How can I ask articles thanks has_and_belongs_to explicitly. And thanks
has_many only too?
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk"...
2006 Mar 22
10
Need for multiple acts_as_list
I have a model "Childmodel" that belongs_to two other models "Parent1"
and "Parent2". "Parent1" "has_many :childmodels, :order => :positionp1"
and "Parent2" "has_many :childmodels, :order => :positionp2". i.e. The
child is independently positioned within each of its parents.
This works fine and gets me the useful
2006 Mar 27
3
act_as_paranoid and model references
...ne of the
reasons was that I didn''t want to break references between objects
after I "deleted" an object. One of the cases was to know which user
modified something even after I deleted the user.
My problem now is that I cannot access the user after it was deleted
if I use the :has_and_belongs_to :user relationship.
Is there any way to override act_as_paranoid behavior only to access
relationships in some cases even if the object is soft deleted?
2006 Oct 11
5
Marshal Data too short error with ActiveRecord sess. storage
I''m seeing a "marshal data too short" error with an ActiveRecord store
for my session data.
Other posts say that this happens when the size of the session data
exceeds the size of the "data" column in the sessions table. But my
"data" column is a TEXT field so it seems unlikely that I could have
blown it out.
Has anyone else seen "marshal data too
2006 Jul 14
20
Method for associated relationships
I have these tables set up like this:
listings has_many :states
<field>state_id [int]
<other fields....
..............
.............>
states belongs_to: listings
<field>name
<other fields..
...............
.................>
In my view I have <%= listing.name %>
have also tried listing.state_id.name , that didn''t seem to do the magic
either.
This