similar to: What is has_many :through really buying you over HABTM?

Displaying 20 results from an estimated 5000 matches similar to: "What is has_many :through really buying you over HABTM?"

2006 Jul 10
10
has_many :through and foreign key parameters
I just took my HABTM and turned it into a :through since my join table has another "non-joiny" attribute. I went from this: has_many_and_belongs_to :jobs, :join_table => ''tablename'', :foreign_key => ''x'', :association_foreign_key => ''y'' to this: has_many :jobs, :through =>
2006 Jul 10
4
HABTM vs. using has_many :through
All, I''ve heard recently about has_many :through as a necessary alternative to HABTM (when the join table has it''s own id column, say, in a legacy schema). However, is the prevailing Rails wisdom now that one should use has_many :through in _all_ cases? If so, why? Thanks, Wes -- Posted via http://www.ruby-forum.com/.
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 Jul 13
6
Content_for_layout
Question- if I have more then one view I wish to display in a layout , how do I tell content_for_layout what to display and where ? TIA Stuart -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060713/a2d0a8c8/attachment.html
2006 Jul 05
7
HABTM join table has an "ID" column - is this an issue?
All, I''m building model objects for existing tables that I cannot modify. In AWDWR, Dave says "Note that our join table has no id column...The second reason for not including an id column in the join table is that AR automatically includes all columns from the join tables when accessing rows using it. If the join table included a column called id, its id would overwrite the id
2006 Jan 25
14
Salted Hash Login Generator
Does this work with rails 1.0 ? I saw that people said it failed with rails 14.1, which practically identical. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060125/5da24694/attachment.html
2006 May 11
3
can''t call link_to from within a model class
can anyone tell me how to call link_to from within a model class? I''m trying to do something like the following: validates_uniqueness_of :email, :message => "address has already been taken. If you''ve forgotten your password, please click " + link_to(''here'', :action => ''forgot_password'', :controller =>
2006 Jul 11
18
Zip Code Ranges
Does anyone have any recommendations for working with zip code distance ranges? I need to calculate the distances between US zip codes. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/f133d7de/attachment-0001.html
2005 Oct 20
5
Unit Test Error: `load_specification': undefined method `parse' for Time:Class
All, I''ve come across a confusing problem when attempting to run unit tests for an application on OSX (works on Windows). I''m receiving the following error: `load_specification'': undefined method `parse'' for Time:Class (NoMethodError) This is also confusing because I can''t figure out how the error appeared. When I revert back to previous revisions,
2006 Mar 27
3
regular expression matching in routes.rb
All, I have a route specified as: map.connect '':folder/:filename'', :folder => /htmlfiles/, :controller => "eSimply", :action => "preview_HTML" I expect it to invoke the "preview_HTML" action in the "eSimply" controller. Given an argument of "htmlfiles/xyz.html", it keeps saying that it can''t find an
2006 Mar 01
6
How to retrieve attributes from HABTM?
We have tables Users and Communities linked by has_an_belongs_to_many. The join table Communities_Users has additional fields [ is_active, is_blocked, join_date] etc. These are populated using @user.push_with_attributes(:is_active => true,...). Later on how do we update or retrieve the attributes in the link table for a given user or a community with doing it explicitly using SQL? Thanks,
2006 May 06
3
Storing additional data on join tables with Rails
Hi there I need to store additional attributes on join table. Searching the Wiki [1] revealed two possible methods: 1) push_with_attributes, as described by Justin Palmer [2]. Unfortunately, "this method is now deprecated" [3]. Even if it wasn''t, there seem to be inherent problems with that approach, for example with updating those additional attributes, though Joshua Muheim
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
2006 Apr 17
11
Would you switch jobs for the chance to use Textmate?
Lets say you had a pretty decent job, but your company mandated use of emacs. The poaching employer offers you a free copy of Textmate(tm). Would you jump ship solely in order to use Textmate at company B? Cheers, Dave -- Posted via http://www.ruby-forum.com/.
2006 Jun 06
9
How to protect images from public?
Hi, I''m trying to figure out the best way to protect images uploaded by users who may wish to keep them private. For example, if they are uploaded in the default file_column location (/public/blah/blah/1/) then someone can simply type the URL http://www.blah.com/blah/blah/1 and get the image. I can store the images in a non-public directory in the rails app (ie: /railsapp/images/X/)
2006 Feb 17
7
FCGI hanging w/ lighttpd and RoR 1.0 (need to kill -9)
Hi, everyone, I''m currently running a Rails 1.0 project using lighttpd-1.4.9 behind Apache 2 on RHEL 3. My fcgi process (I''m only using one right now) always hangs after some time, which is something I haven''t experienced before (e.g., I''ve run this same app. on a TextDrive account and it works fine there). So ... any ideas on what could be causing this?
2008 Mar 19
6
Back button behavior has changed again in Safari 3.1, after doing a dom update via ajax/RJS
GAH! Here is the firefox behavior, which is perfect: 1) View page 1 2) Update some text by using link_to_remote or remote_form_for, along with an RJS replace or replace_html 3) Navigate to page 2 4) Hit back 5) Page was cached with dom updates, note that the page is show in the same state as it was left Safari 3.0 behavior 1..4) repeat 5) Page reloads, ending up in the state where it was left
2006 Jul 11
4
checkboxes with a has_many :through relation
All, I''m populating a view with checkboxes in a list. I want to be able to assign to my has_many relationship using the post values of these checkboxes. Essentially, I want to populate the relationship table which will create the correct join values in my model. Here is my check_box_tag code: <%= check_box_tag("@current_job[target_list_ids][]",
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 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