similar to: has_many :through

Displaying 20 results from an estimated 700 matches similar to: "has_many :through"

2006 Mar 30
5
Heeelp - no idea what''s going wrong.
I''m working on a simple CMS. The main data type are "listings" a listing habtm (has_and_belongs_to_many) categories and subcategories. Subcategories belong_to categories. Subcategories are basically the same as categories, but they are treated differently in a few situations. The problem is, I can''t seem to write the view/controller/model code that allows me to
2006 Jul 11
0
Inplace editor oddity
I''m having issues handling output of a inplace editor function. When the controller action is successful, it returns the new value that populates the DIV and all is well. When it fails, it sends a js alert to the user. The problem is, after it sends the alert (and the user clicks OK) it then spits back the try/catch javascript code which gets inserted into the DIV. I''ve tried
2006 Feb 25
5
MySQL client ran out of memory
I''m getting the following error unexpectedly for my rails app. I just exported the databae from dreamhost and imported it on textdrive for my rails app. Mysql::Error: MySQL client ran out of memory: SELECT COUNT(*) FROM comments WHERE (comments.listing_id = 2666) /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
2006 May 30
1
Can''t read from file field second time around
This piece of code takes an uploaded image and resizes it. It''s a bit nasty at the moment as I am still messing around with it. What I can''t understand is why it works for one iteration but then fails with: zero-length blob not permitted `'' On the line: img = Magick::Image.from_blob(self.image).first I am basically doing this in the controller and it fails on the
2006 Jun 29
7
sql question for rails
Hi, i was hoping someone could help me out with a small yet quite time-boggling task...i have a two tables users, groups joined in as a habtam relashinship (has and belongs to many) and i need to select from the mydb (mysql if it matters) users out of the User model, in accordance with TWO groups in one rails opperation to improve performance...basicly, say i have ten groups and ten users,
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to. table people with columns person_id, person_name table clubs with columns club_id, club_name And I have the association table: table clubs_people with columns person_id, club_id Now I know how to do this habtm between the two, in order to associate people with clubs that they belong to. However my application also needs a
2009 Sep 10
2
Problem Deleting IMAP Folders
Hello, In my configuration I have mail_location = maildir:/Mail/frank.gr/%n:INDEX=/Mail/frank.gr/ __Indexes/%u I can create new folders in an IMAP session, but when I try to delete I get permission denied. From the LOG Sep 10 13:20:06 IMAP(stuart): Error: unlink_directory(/Mail/frank.gr/ __Indexes/stuart/.TEST) failed: Permission denied ls -ald /Mail/frank.gr/__Indexes/stuart/.TEST
2006 Mar 14
7
Overriding new or create for a model
I have a model where I need to calculate one of the fields when I create a new instance. It seems to me that I should do this in the model code and that I should override the new and/or create methods. Is this the right approach and, if so, how can I execute the existing method but add on my calculation? I want something like: def create -Do the original create first- field =
2006 Jun 16
4
problem with join
Hi all, I''m having a problem with a join inside a paginate, the code is like this: @ruta_pages, @rutas = paginate :rutas, :conditions => conds_arr, :joins => "AS ru LEFT JOIN vehiculos AS ve ON ru.vehiculo_id = ve.id", :per_page => 10, :order => "fecha DESC" The problem with this, is that the query returns the
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 Jan 02
5
DB Modelling the Rails way - Opinions??
Hi, I''m trying to figure the most efficient way to model the following. I can think of at least two ways to relate the tables but from a client/server perspective! I''m wondering how to best (and elegantly)relate them from an AR perspective. A project has many people, A person can work on many projects at any time, A project has many roles, A role is performed by a person, A
2006 Jun 19
3
Using a records "id" in validation
I need to use an order''s id value in a validation. Basically, I am charging an order via a credit card API. I only want ot save the order if the credit card authorization was approved. I also want to send the order id to the credit card API as a transaction reference. And last but not least I want to add an error to the order object if the transaction is declined. The problem is
2006 May 22
4
naming convention for bridge tables.
I read somewhere that the correct naming of bridge tables is in alpha order. For example. I have two tables: houses, and colors. If I want to create a bridge table to associate colors with houses, I would name the table: colors_houses The associations work fine. But, if I have a table named: track_houses. Building a bridge table called: colors_track_houses, gives me model associaton errors.
2006 Jul 25
2
join in legacy DB?
I''ve got a problem with some tables that don''t follow any RAILS standards. how do I define the join in the model when all three tables have wacky names? class Machine < ActiveRecord::Base set_table_name "tbl_CodeMgmt_Host" set_primary_key "Id" end class Pool < ActiveRecord::Base set_table_name "tbl_CodeMgmt_Pool" set_primary_key
2007 Sep 06
4
HABTM association with own class?
If I have a class, Asset, which has and belongs to many associated Asset objects, how do I do this? has_and_belongs_to_many :associated_assets, :class => "Asset", :foreign_key => ?????, :association_foreign_key => ????? Right now, my table has a :first_asset_id and a :second_asset_id, but I don''t see how the objects themselves are supposed to distinguish one from the
2008 Jan 18
6
Odd transfer speed issue
Hi all, I'm seeing slow transfers to/from my samba server. I just tried to copy a 270MB file from a samba share to an XP machine. At first, the estimated time displayed as 141 minutes :( The odd thing is that if I then flood-ping from the server (in this case, I pinged my dsl router), the transfer completes in about 10 seconds. Hitting F5 repeatedly when browsing a share on the server
2006 May 18
8
Concatenated key
Hi all, I started playing a couple days ago with Rails and it find it very interesting. But I''m a bit stuck with making it work with a concatenated primary key. I want to use my own names for the DB fields and I''m using SQL Server 2005. My tables look roughly like this: CREATE TABLE USERS ( USR_ID VARCHAR(25) NOT NULL PRIMARY KEY, USR_PASS VARCHAR(25) ) CREATE TABLE
2005 Dec 19
4
need some help designing my messaging system
I am trying to create a messaging system for my users but I''m having a hard time designing my db. This is what i have in mind, but I am not sure if its the best approach. user has_one inbox user has_one outbox inbox has_many messages outbox has_many messages inbox table user_id outbox table user_id messages table box_id (refers to either inbox or outbox - how?) from_id to_id
2006 May 16
4
Problems with multiple ''id'' columns in a join_table
I have a problem declaring a relationship through a join_table ; the SQL generated by ActiveRecord is correct, but there are two columns called ''id'', and the final object gets the ''wrong'' column ... Here''s a more detailed description of the data, code, and problem :- There''s a People table, with id, name, and a few things. Also a
2005 Dec 28
3
acts_as_taggable query
Hi , I couldnt find any mailing list for this nice plugin so I hope this is not off topic.I just have a basic question here. I already had created a table and a model for the tags and items and the join table and now want to use this plugin but I just cant seem to figure out how to make it use my table instead of the default. class Tag < ActiveRecord::Base # already exists and has the