similar to: ActiveRecord boolean false returning Nil

Displaying 20 results from an estimated 20000 matches similar to: "ActiveRecord boolean false returning Nil"

2006 Feb 08
1
Boolean values with Oracle?
Oracle has no boolean value type, so how do i treat fields as being boolean in activerecord?? I know i could rewrite the accessor methods in the model class to return the correct boolean value, but this seems too tedious and wrong. Does anyone know a better way?? Any help is greatly appreciated, Thanks, Chris -- Posted via http://www.ruby-forum.com/.
2010 Sep 02
1
ActiveRecord::ConnectionAdapters::Column value_to_boolean(value) does not return a boolean value.
value_to_boolean(value), does not always return a boolean value, only when true. 150: def value_to_boolean(value) 151: if value.is_a?(String) && value.blank? 152: nil 153: else 154: TRUE_VALUES.include?(value) 155: end 156: end If value is contained in TRUE_VALUES then it returns true(TrueClass). But if value is
2006 Mar 29
0
Rails 1.1 - model access from view broken
I have a problem when refreshing a view that accesses a model method. The method call works on the first iterration, but on subsequent page refreshes, it generates an "undefined method" exception. The method call is programatic (ie, it''s not an accessor). For some reason, it ends up in ActiveRecord::Base#method_missing, which seems to be intended for attribute accessors.
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/. --~--~---------~--~----~------------~-------~--~----~
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?
2008 Jul 10
0
User.protected_attributes returning empty Set instead of nil -- causing activerecord/lib/base:2307 to raise
I have a model that uses attr_accessible, and in my tests I get this: RuntimeError (Declare either attr_protected or attr_accessible for User, but not both.): /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:2307:in `remove_attributes_protected_from_mass_assignment'' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:2114:in
2006 Aug 20
0
Re: Problem with overriding rails accessor methods
On 8/20/06, Paul Corcoran <prcorcoran-Wuw85uim5zDR7s880joybQ@public.gmane.org> wrote: > > > Hello all, > > I just encountered something that is not what I would expect. I > overrode an accessor method in my model class and within this method I > did a "super" call which failed. Of couse my real method would be doing > more but here is the basic code that
2010 Nov 07
1
On Mac: undefined method `create_popup_menu' for #<Wx::TaskBarIcon>
Hi there, I got the following error every time when I tried right clicking the app icon on Dock. Env: Mac OS X 10.6 wxRuby: wxruby-2.0.1-universal-darwin-9 Error: undefined method `create_popup_menu'' for #<Wx::TaskBarIcon:0x1884be40> Backtrace: /Users/zhimin/Work/projects/testwise/vendor/source/darwin/gems/wxruby-2.0.1-universal-darwin-9/lib/wx/accessors.rb:50:in
2006 Aug 06
2
help with method_missing in ActiveRecord
I am serializing a data object (FooData) into an ActiveRecord column (Foo). I''d like to be able to do delegate methods to the data class if the Foo class doesn''t have that attribute. So instead of: f = Foo.new f.data.item1 I''d like to do: f = Foo.new f.item1 I was hoping that I could add a method_missing method to my Foo class and call methods in the FooData class
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of our rails apps and created a test project to try out different theories on what was going on. The result so far is a very small test case app that perfectly reproduces the problem. The question is, is there anything *wrong* with what we''re doing here, or is it a problem with ActiveRecord? We''re on rails
2006 Apr 04
9
Does ActiveRecord have support for "Boolean" columns?
Hey all -- I''ve been using enumerable char(1)''s with ''y'' and ''n'' values for my Boolean columns in Rails, but it strikes me there should be a better way. How do you setup columns that represent true/false-ness in your schemas on Rails? Wondering what kind of standard approaches there are other than me writing something like class MyEntity
2013 Mar 28
1
undefined method 'sanitize_limit' for #<ActiveRecord::Relation:0x2aaaad35d720>
I am trying to upgrate rails from 3.0 to 3.1, while updating rails version I am getting following error rake aborted! undefined method `sanitize_limit'' for #<ActiveRecord::Relation:0x2aaaad35d720> /some_package/lib/ruby/gems/1.8/gems/activerecord-3.1.12/lib/active_record/relation.rb:460:in `method_missing''
2007 Oct 24
7
NoMethodError when creating new ActiveRecord model object
the strangest thing is happening...i''m not getting this every time, maybe 1/3 of the time, identical requests... i''m a rails newbie, but i think i''m trying pretty standard stuff, this is an excerpt from the log: ---------------------- Processing EmailConfigsController#edit_xml (for 127.0.0.1 at 2007-10-24 15:52:09) [GET] Session ID: 6630219819a2da423d8c48a259dd28d6
2017 Jan 15
4
[Bug 2664] New: Boolean option parsing is excessively case-sensitive
https://bugzilla.mindrot.org/show_bug.cgi?id=2664 Bug ID: 2664 Summary: Boolean option parsing is excessively case-sensitive Product: Portable OpenSSH Version: 7.4p1 Hardware: Other URL: https://bugs.launchpad.net/bugs/1656557 OS: Linux Status: NEW Severity: enhancement Priority:
2006 Jun 30
14
Saving boolean attributes
Hi, I''m just learning Ruby on Rails and ran into something where I know I''m either doing something very stupid or I''m missing something. My model as a boolean attribute called active_flag. In my Sql Server database this is stored as a bit value. I then setup a method in my controller called "deactivate". This is very simple, it does: def deactivate
2006 May 20
1
acts_as_paranoid overrides ActiveRecord::Base??
Guys, I am trying to figure out what exactly does this line do at the end of "acts_as_paranoid" plugin? ActiveRecord::Base.send :include, Caboose::Acts::Paranoid::ActiveRecord My problem: I have some classes that I use acts_as_paranoid, and others with tagging support. Classes declared as taggable, throw error, which appears to be in the acts_as_paranoid version of the
2007 Apr 03
2
CalendarCtrl.date not working?
I finally got my CheckListBoxes under control (thanks Alex& Phil) and have moved on to tackling the CalendatCtrl. This one seemed pretty easy when I was reading through the documentation but I cannot retrieve the selected date. I have the following code: def initialize... ... @calendar = panel.add(Wx::CalendarCtrl[]) panel.add(Wx::Button[:label => ''test'']) do
2006 Aug 12
2
Extend ActiveRecord::Base
Hi, I want to exten ActiveRecord::Base with own methods: class Stock < ActiveRecord::Base def compare_own ... end end But call Stock.compare_own fails: NoMethodError: undefined method `compare_own'' for Calendar:Class /var/lib/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1129:in `method_missing'' But why? I want to use only ActiveRecord from RoR, I
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
2008 Nov 19
3
Overwriting / Decorating ActiveRecord association accessor
Hi, I am trying to overwrite the accessor of a has_many association. Basically my class looks like this: class Person has_many :emails has_one :link, :class_name => ''PersonProxy'' def emails_with_link link.emails + emails_without_link end alias_method_chain :emails, :link end Now that works fine if I only access the collection like >>