similar to: HABTM acting as list on Rails 2

Displaying 20 results from an estimated 10000 matches similar to: "HABTM acting as list on Rails 2"

2006 Jan 14
0
habtm with acts_as_list vs. :through
Hi, I am interested in has_and_belongs_to_many with an acts_as_list relationship where the position field is in the join table. I found the following tutorial http://wiki.rubyonrails.org/rails/pages/HowToUseActsAsListWithHasAndBelongsToMany Is there a newer way that is less complicated? What about the :through parameter that I read DHH is writing? Is that a reality yet? Thanks, Peter
2006 Mar 08
2
Need some brainstorming help: acts_as_taggable_list?
I''m trying to figure out the best way to set this data model up. I''m still pretty new to Rails, but hopefully I could turn this into something useful to others as well. Here are the basics: User has_many items items are taggable (items habtm taggings, tags habtm taggings) I also want users to be able to order their tagged items. So if I''ve tagged 5 items as
2006 Feb 16
1
HABTM -VS- belongs_to/has_many, for self-referential joins
Ok, David says on page 241 that sometimes a many-to-many relation with attributes are better implemented as an actual model instead of using HABTM. Well, I''ve got that situation and I can''t figure it out. All of the examples in the book have HABTM examples between 2 different tables, but I want to have a HABTM relation on 1 table with itself. (e.g., if I have a table Things,
2009 Jan 25
1
habtm relation and dependent => :destroy
Hi all , I have a habtm relation between 2 tables: - users - rights If there a way to affect a destroy dependance on those 2 tables only for the last instance? In my opinion, dependent => :destroy is not the solution because this delete all the linked instance. For example, if I have: # in User model this: - "Joooooo" - "Jeannnn" - "Tommmm" # in Right
2006 May 12
2
How to declare several HABTM-relationships?
Hello, Is it possible to have several HABTM-relationships for the same object? Example: Imagine I have 3 objects (classroom, student, teacher) and define the associations for the student as: class Student < ActiveRecord::Base has_and_belongs_to_many :classrooms has_and_belongs_to_many :teachers class Classroom < ActiveRecord::Base has_and_belongs_to_many :students class Teacher <
2006 Mar 08
0
combining STI + polymorphism + rich self HABTM : how to ?
Hi all, I need to model simple typed polymorphic relations: ''John'' [''works_for''] ''Bill'' ''John'' [''speaks_for''] ''Microsoft'' ''Microsoft'' [''hold_shares_of''] ''Apple'' I''m having a hard time combining : - S.T.I.
2006 May 30
3
extra attributes in habtm
Hi, Posting here since issue tracking isn''t the best place to discuss. I can understand habtm is moving towards deprecating support for extra attributes in join_table, and to use :through for those cases instead. To clarify, patch<http://dev.rubyonrails.org/attachment/ticket/5216/habtm_join_table_test.patch1.diff>for #5216 <http://dev.rubyonrails.org/ticket/5216>
2006 May 24
2
"Stack Level Too Deep" issue in HABTM Unit / Functional Test
Hello guys. I was able to figure out that my "stack level too deep" error I was getting with my HABTM destroy method was the result of a bug in rails 1.0. I upgraded to 1.1.2 and now the views and any console-run commands for destroying AR objects linked together via HABTM work just fine. I have HABTM setup between stories and submissions. The issue is that the destroy methods in
2006 Dec 29
4
Strange HABTM behavior against SQL Server (AR 1.14.4)
All, Win XP SQL Server 2000 Rails 1.1.6 (AR 1.14.4) I have two objects (Job and Warning) in a HABTM relationship. Below are the pertinent sections of the model files and the schema for the join table. job.rb: class Job < ActiveRecord::Base has_and_belongs_to_many :warnings, :foreign_key => ''JobReferenceNumber'' set_table_name :JobData set_primary_key
2007 Jun 14
1
HABTM and acts_as_list
I don''t think this needs much explanation. Is what I''m trying to do even possible? class CreateLanguagesProducts < ActiveRecord::Migration create_table languages_products do |t| t.column :language_id, :integer t.column :product_id, :integer t.column :language_position, :integer end end class Language < ActiveRecord::Base acts_as_list :scope =>
2011 Jan 14
0
[Rail3] How to construct full-text search for habtm associations
hi all, i''m new to this group and currently using Rails 3.0.3 and meta_where 0.9.10. i''m considering how to make a full-text searching feature to my project, and my models, for example, should be defined like below: class Group < ActiveRecord::Base has_and_belongs_to_many :users # :title (string) end class Comment < ActiveRecord::Base has_and_belongs_to_many :users
2006 Jan 04
2
Updating Attributes in a HABTM Join Table
Is there a way to update attributes in a HABTM join table? Right now I am deleting the join and then recreating it with new attributes. I have a table "categories" and another table "items". They are both HABTM with the join table "categories_items" between them. If an item is joined to a category once, no problem, we create the join. But if an item is
2006 Jun 05
7
Is HABTM Dying?
For a while, I''ve been getting that HMT is replacing HABTM. It appears that HMT can do all of what HABTM can do and more. The question is: Should I stop using HABTM? Let''s take a simple case: A case has many categories For a given category, there are certain valid statuses Category has_and_belongs_to_many :statuses Status has_and_belongs_to_many :categories Question: Is
2006 Feb 14
1
Another HABTM Question
Hi there, I have a question on what would be the best way to save a HABTM model. A posting habtm categories, and a category habtm postings. class Category < ActiveRecord::Base has_and_belongs_to_many :postings end class Posting < ActiveRecord::Base has_and_belongs_to_many :categories end In my blog_controller, where the actual posting is saved, is where I think I''m
2006 May 31
6
habtm on an array (or object.habtm.habtm)
Hi, I have three Models: User, Group and File. User habtm groups and Group habtm Files How can I find all files that a particular user has access to? eg user.groups.files ? As user.groups returns an array, the above doesn''t work. Id like to find the files for all groups in that array, without adding any code to the User model. Thanks in advance PS I just posted this in the
2006 Jun 30
2
how to HABTM with STI ??
Hello all This is my first post so excuse the basic question. (and any repeats I just got an email saying this post was too big so I have re-submitted a smaller version) I was following the thread on http://lists.rubyonrails.org/pipermail/rails/2006-May/038988.html regarding the STI on HABTM for RoR. I have a very similar problem and was hoping for some help. I have the
2006 Nov 04
0
Model.delete_all vs Model.destroy_all in a habtm
Hi there I have an habtm association between 2 Models. I regularly have to truncate the table on one side of the relationship and repopulate the table with a fresh csv file. I notice that f I do Model.delete_all, none of the records in my habtm join table get deleted, whereas if I use destroy_all they do. However, the overhead of using destroy_all is too great. For the amount of records I have
2005 Aug 11
0
No-brainer HABTM vs. select input question
Pardon my newbness. I''m trying to create, populate, and save an object with an HABTM mapping. That''s not working too well so far ;) Assuming I have the mapping correct (HA!) and the db set up properly, how do I create the select and options? I guess mostly I want to know what I''m supposed to name it. I have a FilingEvent class - HABTM State (both models have the
2006 Feb 23
1
HABTM testing - fixtures not loading?
Hi, I have a strange problem with testing classes which have a HABTM relation. It seems that while running my tests with rake the fixture for the association table is not loaded - as a result I get a failure on a test which simply checks the number of associated elements - it says it''s 0 although there should be one. The weird thing is that when I run the tests with rcov
2007 Jun 30
1
HABTM ReadOnlyRecord
Hi. I get this error: ** ActiveRecord::ReadOnlyRecord ** When i try to update a table called characters_learning_abls that is a habtm relation between characters and learning_abls. The characters_learning_abls table looks like this: ** character_id int(11) unsigned learning_abls_id int(11) unsigned amount double ** Why cant i update this table though the **