search for: target_list_ids

Displaying 5 results from an estimated 5 matches for "target_list_ids".

2006 Jul 18
2
validate method doesn''t recognize another instance method
All, I am attempting to do some custom validation on my object. Here is my validate method: protected def validate puts "Do I have the target_list_ids method? " + self.methods.include?(''target_list_ids'').to_s if target_list_ids.nil? || target_list_ids.length == 0 errors.add_to_base("You must choose at least one target list for this job") end puts "Do I have the Fax method? " + self.met...
2006 Jul 11
4
checkboxes with a has_many :through relation
...s 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][]", tlist.DataSetID, @current_job.target_lists.include?(tlist)) %> So, in this example, tlist is an element of another array that I''m starting with to give me the list of choices. But what I want is to assign these choices into the "t...
2006 Jul 12
1
validate method not getting called?
Here''s a snippet of my model: validates_presence_of :from_name, :from_email, :reply_name, :reply_email, :eSubject protected def validate puts "Calling: #{target_list_ids}" errors.add_to_base("You must choose at least one target list for this job") if self.target_list_ids.nil? end It appears that the validates_presence_of are being called just fine, but my validate method is not. I never see the puts message that I inserted to prove that it...
2006 Jul 12
0
Give form elements "fieldWithErrors" class in non-std. way?
...of my model to be invalid, but not generate any message for it, so that the corresponding form field on a form will show up with the ''fieldWithErrors'' class. I have some checkboxes on my RHTML form, and they are generated with this code <%= check_box_tag("current_job[target_list_ids][]"...etc. %> target_list_ids is an attr_accessor attribute and does not exist in the backing table for my model. If none of these checkboxes are checked when the form is submitted, the validate method puts up a message complaining. That''s fine. But I also want the fieldWithE...
2006 Jun 27
3
belongs_to <parent name>, :foreign_key modifier not working
All, I have two ActiveRecord objects. TargetList has_many Targets Targets belongs_to TargetList I''ve specified belongs_to :target_list, :foreign_key => ''DataSetID'' Queries generated by various methods in target_list do not seem to see the foreign_key name and keep trying to query my Target table using "target_list_id" (the default foreign