search for: m000472

Displaying 4 results from an estimated 4 matches for "m000472".

Did you mean: m000412
2005 Dec 15
8
How to ensure deletes cascade to associated models?
I have the following models: class Resume belongs_to :resume_assignments end class User belongs_to :resume_assignments end class ResumeAssignment has_one :resume has_one :user end When I delete a resume, I want to make sure that its associated ResumeAssignment gets deleted also. Calling destroy_all to delete some resumes doesn''t seem to do this. Is there an option that will
2006 Jan 11
7
Create a relationship with 2 or more tables on 1 insert
userstable: |id|name|password| userdetailstable: |id|col1|col2|col3|user_id| this is my code: [code] def create @user = User.new(@params[''user'']) @userdetail = Userdetail.new(@params[''userdetail'']) if @user.save and @userdetail.save flash[:notice] = "Save succeeded..." redirect_to :action => ''list''
2005 Dec 19
4
has_one, the = operator and validates_associated
...A. So far so good. But rails does this great thing by relfecting on this relationship and enables me use the equals sign to do A.B=B. But now comes the puzzlement. Whenever you do this B is supposed to be saved (see, http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html#M000472). Now a couple of questions, where do the errors go if one implemented a validate method? I guess nowhere and they are ignored. Moreover if you use ''validates_associated :B'', which makes sense, you are forced to use the equals sign method, which supposedly already saves the mo...
2006 Jan 03
4
Set the foreign key constraint column name?
I am applying Rails to an existing schema and not sure how much the existing developers will let me go in and rename things. So I need to discover the limits of what I can change with Rails. I''ve found set_table_name and set_primary_key, which have been very useful. If I have a "foo has_one :bar" relationship, but then in the bar table my column is named "fooid"