similar to: Why is false.blank? => true ?

Displaying 20 results from an estimated 10000 matches similar to: "Why is false.blank? => true ?"

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
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
2009 Sep 21
0
Polymorphic form
I have two partials to deal with contact information. The Contact information uses single-table polymorphism. I want to be able to use save on Contact and set ''type'' manually, based on the type of form the user is filling in. This is saved as the value on a hidden field. class Contact belongs_to :person acts_as_list :scope => :person validates_presence_of :type
2007 Feb 26
2
boolean db fields set to false fail validation with validates_presence_of?
I have a model that contains a :boolean field. In my view, I have a simple select of Yes or No, which equates to true or false, respectively. If I choose yes and save, everything works great. If I choose no, my model fails validation as I have this set as a required field using validates_presence_of. I have checked the log and it''s definitely set to false, why would this fail validation?
2009 Jan 12
2
validates_presence_of fails with false boolean
This almost feels like a bug to me, since false is not nil. (i don''t think!) Using v_p_o on a boolean field fails validation if the field is passed with ''false''. It passes validation in the case of true. How can I validate _presence_of a boolean if it is submitted false? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~
2006 Jan 11
1
HELP!! - ActiveRecord derivates in AWS :expects method
Hi, I have a strange problem while using WebService API which expects an ActiveRecord derivate. This is the code of the API ... ------ class HarvesterApi < ActionWebService::API::Base api_method :send_measurand, :expects => [{:measurand => Measurand}, {:eaiSystemName => :string}] end ------ ... and this of my Model ------ class Measurand < ActiveRecord::Base
2005 Dec 16
0
ArgumentError on create
I have several validations applied to my model: class Quote < ActiveRecord::Base has_many :files validates_presence_of :title, :source, :quote, :message => "Missing Field Required" validates_length_of :title, :source, :maximum => 80, :message => "Maximum Length 80 characters" validates_inclusion_of :year, :in=>1911..2006, :message => "Year must be
2006 Aug 14
2
Plugins: Validation Reflection and Client-Side Validation
I''ve just put two plugins on RubyForge. Included below are the READMEs. You can get the plugins at svn://rubyforge.org//var/svn/valirefl/validation_reflection/trunk svn://rubyforge.org//var/svn/clientsidevali/client_side_validation/trunk Michael Validation Reflection ===================== Version 0.2, 2006-08-06 This plugin adds reflective access to validations -
2006 Jul 08
1
Need Help Understanding Situation with Table Columns
I am trying to create an application loosely based on the Depot application presented in Agile Web Development with Rails (AWDwR). I am using InstantRails for the server. In my app I have the folowing controllers: admin_controller application_controller city_map_controller (with method: displayGMap) The admin_controller was created with the following command: ruby script/generate scaffold
2006 Jan 05
3
ActiveRecord model classes not allowed in :expects
Hi, I have a strange problem while using WebService API which expects an ActiveRecord derivate. This is the code of the API ... ------ class HarvesterApi < ActionWebService::API::Base api_method :send_measurand, :expects => [{:measurand => Measurand}, {:eaiSystemName => :string}] end ------ ... and this of my Model ------ class Measurand < ActiveRecord::Base
2008 Jul 17
2
problems with validation on STI
I have the following STI table: def self.up create_table :distributions do |t| t.string :type t.integer :simulation_id t.string :dist_name t.string :desc, :default=> ''fixed'' t.float :param1, :default => 5.0 t.float :param2, :param3 t.timestamps #fields for RscDist t.integer :resource_id #fields for LoadDist
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
2013 Jun 26
1
[LLVMdev] clang-format: `AlwaysBreakTemplateDeclarations: true` for LLVMStyle?
Hi guys, Is the current setting of `AlwaysBreakTemplateDeclarations: false` for LLVMStyle intentional? What was the rationale? Some rough counts on the LLVM codebase: same-line: $ git grep -E 'template.*(class|struct).*{' -- '*.h' '*.cpp' | wc -l 214 (most of them are tiny traits classes, like isPodLike or DenseMapInfo) not-same-line: $ git grep -A1 -h
2009 May 25
1
Help --- My phone number field saves blank
I have a phone field in my table. But in my form i have two text boxes to get the phone number and the country code like below Enter country code ----- Enter phone code ------ In my table i have to save the phone code field after joining the above values with "-" symbol. Example => 0225-25874255 I dont have table field for country_code . So i created like below attr_accessor
2011 Feb 16
5
validates_inclusion_of with range on ruby 1.9
I found out today that Range#include? behaves differently on 1.9 than on 1.8 ( http://rhnh.net/2009/08/03/range-include-in-ruby-1-9 ) In order to deal with various edge cases, instead of just checking whether range.first <= value <= range.last, in ruby 1.9 include? steps through all the values in the range, checking for equality. This is of course a lot slower - in my case, checking a date
2006 Apr 08
4
Calling validates_inclusion_of out of default namespace
Hi, I''m trying to run the "validates_inclusion_of" method in a before_save hook, because the range is dependant on the related data. But I can''t figure out how to call it. When calling it normally, it says it can''t find it. I''ve tried several combinations like "ActiveRecord::Validations.validates_inclusion_of", but I can''t seem to
2007 Jan 18
2
Conditional validates_inclusion_of execution problem
All, I have a field that I''m validating with validates_numericality_of on as well as validates_inclusion_of, like so: validates_numericality_of :number_of_owners, :only_integer => true, :message => ''must be a whole number'' validates_inclusion_of :number_of_owners, :in => 1..3,
2011 Jun 09
1
Error: missing values where TRUE/FALSE needed
I'm writing a function and keep getting the following error message. myfunc <- function(lst) { lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate",
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