similar to: why do i not get error warning from validation?

Displaying 20 results from an estimated 11000 matches similar to: "why do i not get error warning from validation?"

2006 Jan 11
0
Easy Question, I Think
I am just getting started with Rails, don''t know any Ruby, and don''t quite even get object oriented programming yet. I have tweaked my schema to The Rails Way and have generated a bit of scaffolding. I am trying to create a new Part, which references a PartName and a PartNumber. I can create a PartNumber on the fly, but the PartName has to exist. I have an inelegant solution
2006 Jan 12
0
Easy Question, I Think [re-post, sorry if dupe]
I am just getting started with Rails, don''t know any Ruby, and don''t quite even get object oriented programming yet. I have tweaked my schema to The Rails Way and have generated a bit of scaffolding. I am trying to create a new Part, which references a PartName and a PartNumber. I can create a PartNumber on the fly, but the PartName has to exist. I have an inelegant solution
2006 Apr 09
1
select helper question
Hi there, I try to develop a medical application using ruby on rails. There are many categories which can contain subcategories. I defined the model like this: class Category < ActiveRecord::Base has_and_belongs_to_many :notes belongs_to :parent_category, :class_name=>"Category", :foreign_key=>"category_id" has_many :sub_categories,
2006 Jul 21
1
RJS Failing
This code was working before I created the update_link_list method in the helper below (everything was in the controller). I can successfully create a new link but I get a TypeError when I leave all form fields blank -- I expect to see validation error messages. --- #link_controller.rb: def create link = Link.new(params[:link]) saved = link.save num_links = Link.find(:all).size
2006 Jun 20
2
Validation error_messages_for problem
I am having trouble getting error_messages_for to work. My controller(relevant parts) looks like def configure @account = session[:account] @user = User.new end def add_new_user_to_account @user = User.new(params[:user]) if @user.valid? session[:account].users << @user end redirect_to :action=> ''configure'' end end and my
2006 Jun 21
2
error_messages_for not displaying validation errors
Hi all, I''ve been searching the web and the list archives for help on this and I''ve found some tips, but I''ve been racking my brain on this for hours. I have a Model, View, and Controller that are handling the uploading of a file to my server. I want to make sure that the description is set and that a file is selected to be uploaded. I have set validates_presence_of
2006 May 02
0
Model validation when using ajax & form_remote_tag...
I am trying to understand why model validation error reporting in Rails is so complicated compared to non ajax model validation. In my normal form I use <%= error_messages_for ''user'' %> in my view and I get a nice error message displayed when the user inputs invalid information into the form. When I convert that form to use Ajax using form_remote_tag the
2006 Jul 21
0
Ajax page.replace_html model validation errors
I have the following setup: A model: that validates using helpers like: validates_presence_of, etc.. A view: called ''new'' which renders a partial The partial: _form which has error_messages_for and a form_remote_tag , submit_tag and end_form_tag An action ''create'': that gets executed via the submit_tag in the _form and which in case it can''t
2009 Oct 07
1
Empty validation error messages?
Hello, I''m have a form and the error messages are not being displayed properly I got a remote_form_for and am trying to show errors like I always do: <%= error_messages_for @user%> but the output is: 4 errors prohibited this user from being saved There were problems with the following fields: * {{attribute}} {{message}} * {{attribute}} {{message}} * {{attribute}}
2005 Mar 10
2
Newbie question - form validation
Hi, I am sorry for maybe stupid question. I am new in rails. I am trying to create very simple weblog systeme. I know threre are plenty of them, but It''s good to study. I create following rule in models/post.rb validates_length_of :header, :in => 3..50, :allow_nil => false, :message => "At least 3 characters" It''s working fine with default scaffolt add
2007 Sep 27
1
How to call a model object method for validation?
This is the code I''m trying to get to work: validates_inclusion_of :status, :in => poll_statuses().keys def poll_statuses return { "closed" => "Closed", "open" => "Open" } end It says there''s no poll_statuses method in Poll. How do I access this method? I''ve tried
2006 May 26
4
Using ''validates_inclusion_of'' to validate foreign key
I seem to be missing something trying to use ''validates_inclusion_of'' to validate a foreign key and was hoping some one could piont out my mistake? The problem seems to be that Order.find_all.collect is not returning an array that contains the order_id, if I replace it with a hardcoded array everything works as expected. The model: class OrderItem < ActiveRecord::Base
2007 May 01
2
Problem validating boolean
Hi I''ve got a problem validating a boolean and I can''t see what the problem is. Here''s my model: class FinanceAgreement < ActiveRecord::Base belongs_to :asset validates_presence_of :finance_company validates_inclusion_of :balance, :in => 0.01..10_000_000 validates_inclusion_of :term, :in => 1..600 validates_numericality_of
2006 Jan 03
4
validates_presence_of *_id attributes
Hi all, I am a newbie to Rails. Please enlighten me on how to do this appropriately, the Rails and the Ruby way: Suppose I have a Recipe model. Let''s simplify things and pretend that it has only 2 attributes, a :name and the other is a ''category_id''. In the recipes table, category_id is a foreign key to field id of table categories. We also assume that I have generate
2006 Dec 15
4
Why won't Rails update my object attributes?
Here''s the issue: When I submit a form for updating, @person.update_attributes doesn''t work. But the next nested clause for updating images DOES work. How is that possible? However no matter what I do the Person object will not change its attributes. def edit @person = Person.find(params[:id]) if request.post? @person.update_attributes(params[:person])
2006 Jul 24
0
Ajax page.replace_html model validation render partial errors
Hi; I have the following setup: A model: that validates using helpers like: validates_presence_of, etc.. A view: called ''new'' which renders a partial The partial: _form which has error_messages_for and a form_remote_tag , submit_tag and end_form_tag An action ''create'': that gets executed via the submit_tag in the _form and which in case it can''t
2005 Dec 31
2
Validation errors not displaying and will not save
Hello all, I''m fairly new to rails so I''m probably doing something really stupid here.... I have been banging my head at this for hrs now... I''ve tried so many different things and nothing seems to get me any further... I am trying to create an image uploading page that will simultaneously create thumbnails to separate file directories and update the database via
2006 Feb 14
2
confusion with validates_inclusion_of
It appears that if your trying to use validates_inclusion_of for a string value allow_nil wont work. For example, if I have an attribute :year which is stored as a varchar then: validates_inclusion_of :year, :in => "1980"..Time.now.year.to_s, allow_nil=>true will successfully validate the range but will not allow an empty input field to be submitted. However, if :year is
2007 Dec 27
0
Silent Validation Failures
Hello, I''m having trouble with after_validation_on_create causing my validations to fail silently. I''ve got a restful_authentication based user model that requires a number of things from the user: email, dob, gender, etc. When a user is created, all of these are validated in various ways (presence, inclusion_of, etc.). Afterwards, I call three protected methods using
2014 Feb 22
0
Validates inclusion of include fails at plugin.
Hello, MyModel.rb, TYPES = { "type1" => 1 , "type2" => 2, "type3" => 3 }.freeze validates_inclusion_of :my_type, :in => TYPES.keys --------------------------------------- MyModelPatch.rb, base.send(:remove_const, :TYPES) base._validators[:my_type].reject!{ |validator| validator if validator.is_a? ActiveModel::Validations::InclusionValidator } TYPES =