similar to: Specify options with habtm

Displaying 20 results from an estimated 100 matches similar to: "Specify options with habtm"

2006 Jan 31
2
Habtm: I can create the same relation more than 1x!
Hi all I have a DiscJockey and a Member model, each of them reference each other using habtm. josh $ script/server >> m=Member.find 1 >> dj=DiscJockey.find 1 >> m.disc_jockeys << dj >> m.disc_jockeys << dj >> m.disc_jockeys << dj Now I have 3 relations in the DB! Is this normal? Shouldn''t there an error occur, that I can only add the
2006 Jan 31
2
How can I overwrite the parent.children.push(child) Method?
Hi all I want to overwrite the push method (which is an alias of <<, the same as concat) of collections, and there I want to test if :uniq is set to true in the relationship. If so, the method should check if the passed object is already related to the parent, or not (only then it will be added). But I just can''t find the original code of this method, so I could overwrite
2006 Jul 11
6
@record.each do |record|
I''m trying to ''destroy'' a particular record of a table >From the controller side, i''ve found a list of possible records that i want deleted. ie. @chart = Chart.find(:all, :conditions => ["record_id = ?", param[''id''] ] ''id'' is passed into the controller and @chart is all the possible records that have
2006 Jul 10
4
find()
Can some1 help me on syntax with the find() function. I''m trying to pull up a table record, called chart, that has a particular field specified. ie chart has a field called record_id, which i know. How can i find the record that contains chart.record_id. something like chart = Chart.find(:conditions => "record_id = :id") this gives me an error. I''m passing
2006 Feb 01
0
habtm and counter (xxx_count field in DB)
Hi all I have the following models: class Member < ActiveRecord::Base # DJ Profiles the member is part of has_and_belongs_to_many :disc_jockeys, :join_table => ''members_are_disc_jockeys'', :uniq => true end class DiscJockey < ActiveRecord::Base # Members that are part of this DJ profile
2006 Mar 09
3
Runtime Error
Hi all, Can anyone tell me why this line of code works in FF but not IE?? function stuff(id){ record_id=$(id); record_id.innerHTML = "foo"; } I get a ''Runtime Error''. -- ----------------------- Iggy Sandejas Web Developer 0419 485 252 D-Frag Solutions http://www.dfrag.com.au -----------------------
2006 Jan 25
2
Update join_table attributes
I have two ActiveRecord classes that point at each other with a "has_and_belongs_to_many" (habtm) relationship using a join table. The join table has an a few additional columns besides the _id columns. For those of you with the Agile Web Dev w/ Rails book, it''s exactly the same setup as the articles<->articles_users<->users example on p240. The habtm
2009 Feb 18
5
fields_for and Conflicting types for parameter containers. Expected an instance of Hash but found an instance of Array.
I''m trying to use ''fields_for'' in a form. I want the same form to support both the creation of new obejcts as well as the editing of old ones. So - in my controller, sometimes I will pass to the form an object that already exists in my database and has an id and other times I will pass it a newly created instance of an object that does not yet exist in the database and
2006 Sep 15
2
Caching::Sweeper Access to Controller
Hello, I''m running Mongrel 0.3.13.3, cluster 0.2.0, and Rails 1.1.6 and I have a problem with a sweeper not having access to the controller instance. NoMethodError (undefined method `session'' for nil:NilClass): /app/models/audit_sweeper.rb:16:in `log'' /app/models/audit_sweeper.rb:9:in `after_update''
2006 Jul 10
3
finding particular record
Hi, I''m looking for a particular record from a view called ''charts''. The view ''charts'' joins data from a table ''record'' and a table ''owners''. I''m trying to pull up data from ''charts'' that lists certain data from ''record'' ie. I know i need record.id = 5. Is there a
2006 Jul 11
8
Stop updated_at from auto updating?
Hi Is there any way to temporarily stop the updated_at field from being updated when a record is modified with ActiveRecord? I have a date field which is keeping track of when the record data was last checked by my application and my app manually updates it, of course when I do this the updated_at field is also touched making it fairly useless for finding out when the actual data was changed
2008 Jun 24
10
Question on passing arguments inside a view.
I''m running into an issue undefined local variable or method `directoryid'' for #<EditorialsController:0x23f1bf8> I have two Models on a legacy database and only one controller called editorials with two actions index and display. I''m trying to pass in a parameter from the results of my search and getting the above error. Example: two tables one is editorial the
2010 Aug 20
0
[PATCH 1/2] Implement APEI ERST feature to Xen
Implement APEI ERST feature to Xen APEI are ACPI4.0 new features. It consists of ERST, BERT, HEST, and EINJ. ERST is used to save fault error log to a platform persistent storage, so that when reboot os can retrieve the error log and handle it. This patch is used to implement ERST feature to Xen. It consists of 3-level hierarchy: operation level, action level, and instruction level. Instruction
2005 Nov 22
11
Building a conditions clause (for find) of multiple optional params?
I want to be able to find items according to various params - category_id, member_id, type_id, rating, etc. What I have now is something like: if(@params[''category_id'']) @items=Item.find(:all, :conditions=>["category_id=?", @params[''category_id'']) elsif(@params[''category_id''] and @params[''member_id''])
2006 Jan 16
0
belongs_to with has_and_belongs_to_many
I''m having a problem with belongs_to and has_and_belongs_to_many. Here''s a brief summary of the models involved: class Member < ActiveRecord::Base set_primary_key ''member_id'' has_and_belongs_to_many :projects, :join_table => ''projects__members'' has_many :projects, :foreign_key => ''created_by'' end class
2006 Feb 17
2
validate uniqueness of two fields
I have Proposals and Members and Members can vote for a proposal only once. So, I have "Vote belongs_to :member, :proposal", but to make sure a member only votes once, I want to make sure that there isn''t a vote in the db with that member_id and proposal_id. I can just put the appropriate find in a vote.valid? but I wanted to make sure I wasn''t missing a nice rails
2006 Jun 15
2
AJAX form inside table - error
Hello, I need to put an AJAX, form such that it is inside a table, and spans across few rows. But, what I am noticing is that, while submitting the form, the data in the fields is not submitted. If I move the form outside the table or inside a cell, things work OK, but not when the form is inside the table and spans few rows. This problem is only with AJAX forms, regular forms work perfect. I
2006 Jul 24
0
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
Hi there, I''ve been digging around trying to find some information (mostly examples) on how one would handle a progress bar upload using BackgrounDRb and File Column. I did read http://backgroundrb.rubyforge.org/ and Ezra''s blog of course, but I still have a few questions. I made a simple upload form (as a test) that is submitted to the "upload_song" action. def
2006 Aug 09
1
help:sql search for NULL
Hi, I have two tables with identical fields(assignments, and matches). However, only one of them accept NULL values for its fields. I want to be able to find out all the matches for any assignment. The search should retrun the match if the corresponding filed is NULL as well. I wrote down the following code but it doesn''t return anything. I wonder what I am doing wrong. Any help is
2007 Nov 05
0
Authentication: is a guest a user or an "exception"?
Hi all I''m currently implementing authentication/authorization in my app. Now I''m wondering what''s the common way to handle a guest... In fact, many of the visitors of my app will be anonymous users that just want to read articles etc., but one can register as a member to have some further possibilities. So far one can login as a member and from this point on one has