similar to: validation and update

Displaying 20 results from an estimated 3000 matches similar to: "validation and update"

2006 Mar 13
3
validates_associated problem
Hello, I have a situation where an ''employee'' belongs to a ''department'' and have setup the relationship as follows. class Employee < ActiveRecord::Base belongs_to :department, :foregin_key => "department_id" validates_associated :department_id end class Department < ActiveRecord::Base has_many :employees def validate_on_update
2006 Mar 14
7
Single form w/ relationships: how do I integrate it?
OK - I know this has been asked before, but I cannot find it in the archives. Forgive me if I''m creating more noise than I should. I want to know the easiest way to deal with this scenario: I have articles. I have categories for the articles. On the form where you write an article, there needs to be a free-form field to entire the category. The create() method will build the
2006 Mar 13
6
JobsOnRails
Announcing... JobsOnRails! I''m creating on a Ruby on Rails oriented job site and will be launching in the next few weeks. It''s a Rails-centric place for developers and employers to get in touch with a minimum of hassle. For now, I have a short outline of my ideas and an email signup form on the live site at http://www.jobsonrails.com. The site is coming along nicely and
2006 Jul 22
7
Validation with has_many
I have two problems. I have a comment that has_many uploads. Before saving the comment, I want to be sure that the upload(s) has passed validation, but I also need to validate in other ways. For example, I do not want to save the comment if there is no comment or upload. Or, I do not want to save the comment if the image has been uploaded previously (comparing md5s with past upload md5s
2006 Mar 13
9
what the » ???
Im just learning trough the "geting started with ruby" i''m only on page Ruby.new and im stuck here''s the thing, I''m using FreeRIDE to duplicate the examples a = %w{ ant bee cat dog elk } a[0] ? "ant" a[3] ? "dog" for the live of me i cant seem to use Alt+0187 (?) what happen?? -- Posted via http://www.ruby-forum.com/.
2006 Jun 20
2
habtm, multi select, and validation
Greetings - I''m trying to find the most efficient, "Rails" way to solve the following problem. It''s in two parts, but I think the solution is somewhat related: I have Recipe and Category model related by HABTM. I would like to 1.) Validate the *number* of categories associated with a recipe, say a minimum of 1 and a max of 3. (So validates_associated will not
2005 Oct 12
4
Validating 2 related models at once not working
Hello, I have a form that submits data to two related models/tables. One is Customer the other is Address. Validation for Customer works fine but not for the Address. Class Customer < ActiveRecord::Base has_one :address validates_presence_of :login, :password, :email validates_associated :address end Class Address < ActiveRecord::Base belongs_to :customer validates_presence_of
2009 Nov 20
3
Ensuring that foreign key is valid
I am trying to set up a validation in a model to ensure that a record can''t be saved unless the foreign key it belongs_to is a valid record. My model says: class Admin < ActiveRecord::Base validates_presence_of :user_id validates_numericality_of :user_id validates_uniqueness_of :user_id validates_associated :user belongs_to :user end but I can still create an admin
2007 Dec 22
3
collection_select validation problem
I''m trying to assign a parent foreign key value using collection_select from my child "new" form. The problem I''m having is if I do not make a selection, I get the following error instead of the Rails validates_presence_of error: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating
2006 May 28
3
Validating Foreign Key
Howdy, I''m a Rails beginner working on my first significant project with RoR. I''m trying to figure out how to validate a foreign key (you know, make sure the row actually exists.) However, validates_associated doesn''t seem to be what I want to use, nor does it work... -- BEGIN -- class City < ActiveRecord::Base has_many :schools belongs_to :state
2006 Oct 22
3
Date Helpers?
Does anyone have any ideas off the top of there head how to easily construct a date helper as one would see in Rails? Thanks, Michael Gorsuch http://www.styledbits.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/camping-list/attachments/20061022/7dda5a52/attachment.html
2018 Sep 07
1
rsyslog listening on high port
On Thu, 2018-09-06 at 15:10 -0400, Mike Burger wrote: > On 2018-09-06 14:06, Adam Tauno Williams wrote: > > Attempting to lookup why rsyslogd is listening on the high port > > UDP/51427.????Have not succeeded in what this port is used for and > > what directive controls what interface it binds to. > > [root at bedrock ~]# netstat --listen --inet --program --numeric |
2007 Jun 21
1
Validation Through Multiple Models from one Form
Hey All, I have a form that submits data to multiple models. I have class Man < ActiveRecord::Base has_many :notes has_many :contacts validates_associated :contacts, :notes validates_presence_of :first_name validates_presence_of :last_name class Contact < ActiveRecord::Base belongs_to :man validates_presence_of :contact_info class Note < ActiveRecord::Base
2006 Apr 03
8
[OT] - Career Advice
Hey everyone - I have a career-related question for you all. I currently work full time as a Sr. Sys Admin, and have been doing systems work for about 9 years. I have been doing web development work on and off during this time, and have written quite a few internal applications and scripts for several companies I worked for. I have never worked in the full time capacity of a software developer
2006 Mar 04
7
Get ID after save
This is simple (I am sure) but how do you get the id of the inserted element after the element has been save? I thought it was something like this: @product = Product.new(params[:product] if @product.save add_image(product.id, params["image"]) flash[:notice] = ''Product was successfully created.'' redirect_to :action => ''list_products'' end
2006 Jun 13
6
Dead horse: validates_associated
Regarding validates_associated... Let''s say I have: article belongs_to author But for whatever reason, I want an article to also be written anonymously and therefore not require an author. Then I have: Article: belongs_to :author validates_associated :author But I DON''T have validates_presence_of. What I want to do is validate that an author is valid --if it is
2007 Jun 29
1
attachment_fu validation error
I have this class: class Logo < ActiveRecord::Base has_one :something has_attachment :content_type => :image, :storage => :db_file, :max_size => 500.kilobytes :thumbnails => {:web => ''150x100'', :pdf => ''150x100''}, :processor =>
2007 Dec 21
0
RMySQL installation
Hi, I am having trouble getting RMySQL running on a solaris machine. [43] bedrock:/home/jayoung/source_codes/R/other_packages> uname -a SunOS bedrock 5.10 Generic_118833-36 sun4v sparc SUNW,Sun-Fire-T200 I thought I had finally managed to get it installed, albeit with some warnings that I didn't understand (it took me a while to find where our mysql libraries were), but when I tried
2006 Mar 10
1
Validate fields and display errors from two models?
Hi, I have here a problem I''ve been working at for a little while but I can''t seem to get the error messages to appear correctly. My form looks something like this for "ModelA": [errors_for "modelA"] [form for "modelA"] [text "modelA" "fieldname1"] [text "modelB" "fieldname2"] [submit] [/form] The reason
2007 Jan 09
4
Overriding ServerError?
I''m getting ready to deploy a production app based on Camping, but have one little thing I want to iron out. Is it possible to override the ServerError class? I need custom 500''s to come up, and not the normal "Camping Problem!" page. I am trying to override, just like I do the NotFound class, but can''t seem to get it to take. I just get a blank page back