Displaying 20 results from an estimated 21 matches for "trueclass".
2006 Jul 17
6
DRY? Converting Boolean to Yes/No
...but wants confirmations to
read:
Change address: Yes
In an isolated case something like:
@obj.change_address ? ''Yes'' : ''No''
Would work fine but this is peppered throughout scads of forms and boolean
fields. The first step I took at DRYing this up was:
class TrueClass
def to_s
"Yes"
end
end
class FalseClass
def to_s
"No"
end
end
But this breaks other uses. For example observe_field constructs the
observers based on the to_s conversion of boolean attributes.
Any ideas on how to DRY this usage up?
Thanks
--
View this messag...
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
...administrator,
GlobalAccessibility.new,
OwnerAccessibility.new)
root.save
self.root = root
end
But now I get am getting an exception "undefined method `each'' for
true:TrueClass" when root.save is executed.
fyi, the "create_root_collection" method creates a "root" object and
assigns new object to its "belongs to" association.
I have traced it through carefully and it is definitely failing when
trying to save the "root" object...
2010 Sep 02
1
ActiveRecord::ConnectionAdapters::Column value_to_boolean(value) does not return a boolean value.
...ly
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 anything else it returns nil(NilClass) instead of
false(FalseClass)
This does not seem consistent or expected to me since false <> nil.
Since we have TRUE_VALUES and FALSE_VALUES, I think it should be
something like this.
150 def value_to_boolean(value)
151...
2006 Jan 06
6
AWS and array of Model
Hi!
I try to use a layered webservice and I want to get back an array of users;
In the API I use:
api_method :listUsers,:returns=>[[User]]
in the service:
def listUsers
User.find(:all)
end
Result in soap mode:
Don''t know how to cast TrueClass to Object
Result in XML-RPC mode:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.collect
It''s work on another machine. (Here is windows)
I tried to create another ampty project with Only th...
2008 Mar 14
1
Rails App freezes when accessed
Hi All,
I just had this problem come up today and so far I''m stumped. This
morning, my mongrels were all completely unresponsive. I had to kill
-9 them to get them to go away. I restarted them, but the first time
that they were accessed they froze again. Nothing gets printed to the
logs. I tried starting a single mongrel and accessing it directly.
If I hit CTRL-C before accessing
2005 Mar 04
3
Boolean values
Hi,
I''m using SQL Server. I have a BIT field. I have a fix and a question.
This is a patch for a bug in the SQL Server adapter that causes any insert or
update to fail:
lib/active_record/connection_adapters/sqlserver_adapter.rb
@@ -239,2 +239,2 @@
- when TrueClass then (column && column.type == :boolean ?
"''t''" : "1")
- when FalseClass then (column && column.type == :boolean ?
"''f''" : "0")
+ when TrueClass then &q...
2008 Jun 06
1
Need help with Decryption using blowfish CBC
...ry:
require ''crypt/blowfish''
blowfish = Crypt::Blowfish.new("fOyBtMaN4u2T")
blowfish.decrypt_file(''C:\\mapcrypt\\11225035.00X'', ''MAP.TIFF'')
But this returns the error:
NoMethodError: undefined method `%'' for true:TrueClass
from c:/ruby/lib/ruby/gems/1.8/gems/crypt-1.1.4/./crypt/
blowfish.rb:84:in `decrypt_pair''
from c:/ruby/lib/ruby/gems/1.8/gems/crypt-1.1.4/./crypt/
blowfish.rb:82:in `downto''
from c:/ruby/lib/ruby/gems/1.8/gems/crypt-1.1.4/./crypt/
blowfish.rb:82:in `decrypt...
2006 Feb 27
8
Change Bit Value To Text When Viewed
Hey All, very simple question for you folks ;)
I have a @commutes object that for each record there is a bit value set
(0/1) to denote if an accident occurred. What I want to do is have it
display "Yes" or "No" when I view the listing of commutes. I can get it to
display the bit value just fine with <%= commute.accident %> but how can I
get it so that when a record with
2006 May 12
11
Stupid? question about if else logic
this seems so stupid, I keep thinking I''ve dealt with this before but I
have this code
<h1>Portraits</h1>
<% if @image.portrait == 1 %>
<%= image_tag(url_for_file_column ''image'', ''file'', ''thumb'') %>
<% else %>
<h1>Landscapes</h1>
<%= image_tag(url_for_file_column
2009 Dec 18
2
Undefined Method error - help request
Good morning All -
I am working on a time tracking application as a learning excercise
and have run into an error neither I nor Google can remedy.
When loading my view, I get an error: ''undefined method
''true_class_path'' for #<ActionView::Base:.........
Context:
I have controllers for Project, Worktrack and ''Workbench'', among
others. Workbench is
2006 Jan 07
0
Bug in rails?
...t in postgresql the
boolean type is boolean(!).
When in the database table contain boolean type the AWS going to crazy
because it''s can''t recognize it. (It''s say: "Don''t know how to cast
FalseClass to Object" or "Don''t know how to cast TrueClass to Object").
I think it''s a bug because the WebServices contain boolean primitive type.
Cow
2008 Feb 20
0
Unicode Support for MS SQL Server
...etter-N, e. g. ''unicode'' becomes N''unicode'' In order to
accomplish this, I modified SQLServerAdapter#quote to look like this:
def quote(value, column = nil)
return value.quoted_id if value.respond_to?(:quoted_id)
case value
when TrueClass then ''1''
when FalseClass then ''0''
when Time, DateTime then "''#{value.strftime("%Y%m%d
%H:%M:%S")}''"
when Date then "''#{value.strftime(...
2008 Jul 04
1
datatype problem when using ActiveRecord with Oracle
Hey,
I have connected to the oracle db using ActiveRecord and am
trying to retrieve tuples. I have one attribute that has datatype
''number(1)''. I found that ActiveRecord maps this attribute to boolean.
So it gets a class of either FalseClass or TrueClass. I tried to find
the source of the problem and I found oracle_adapter.rb (http://
www.koders.com/ruby/fidAF6400E299159A198A4064173CF305C895FCA945.aspx?s=%22Michael+Schoen%22#L5)
has a method ''simplified_field'' that has a line
"return :boolean if OracleAdapter.emulate_booleans...
2008 Apr 07
0
Haml and View tests
Does Rspec work nicely with Haml for controller integrated view tests?
I am getting the following error:
===================
ActionView::TemplateError in ''Admin::ListingsController index should get
a 200 OK''
undefined method `photo'' for true:TrueClass
On line #2 of admin/listings/_listing.html.haml
1: %tr
2: %td.photo= image_tag(listing.photo.url(:thumb), :class =>
:photo)
Both photo and the photo.url are stubbed out.
Thanks for the help.
--
Posted via http://www.ruby-forum.com/.
2006 Jul 29
1
Problem starting push server in Jugganaut
Hi All,
Im playing around with Jugganaut but stuck at the first step.
Seems the jugganaut push server requires json (which I have installed)
but it cant find it.
Following the docs, I have installed json and then try to run the push
server.
jonathan $ ruby script/push_server
script/push_server:37:in `require'': no such file to load -- json
(LoadError)
from
2006 Oct 19
3
Selecting datetime values from SQL Server (year < 1970)
All,
Rails 1.1.6.
Any AR find() call that generates a SELECT * type query against a table
with a DATETIME column in SQL Server whose value occurs before 1970 will
fail, because of the coercion of SQL Server datetime types to Time
values in Ruby.
See sqlserver_adapter.rb line 490
(record[col] = record[col].to_time if record[col].is_a? DBI::Timestamp)
If I remove the coercion (just commenting
2006 Nov 01
0
fatal flaw in popen4 on windows? [WAS] Re: Nonblocking IO read (fwd)
...t ) ]
> stdout_timeout = getopt[ %w( stdout_timeout io_timeout ) ]
> stderr_timeout = getopt[ %w( stderr_timeout ) ]
> status = getopt[ %w( status ) ]
> cwd = getopt[ %w( cwd dir ), Dir.pwd ]
>
> exitstatus =
> case exitstatus
> when TrueClass, FalseClass
> ignore_exit_failure = true if exitstatus
> [0]
> else
> [*(exitstatus || 0)].map{|i| Integer i}
> end
>
> stdin ||= '''' if stdin_timeout
> stdout ||= '''' if stdout_tim...
2009 Apr 10
4
rails2.3/ruby1.9: invalid byte sequence in utf-8 with blank?
hi all,
anyone seen this controller argument error:
invalid byte sequence in utf-8
ror/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb:
50:in `=~''
ror/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb:
50:in `!~''
ror/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb:
50:in `blank?''
2013 Oct 25
2
[PATCH] support SO_REUSEPORT on new listeners (:reuseport)
This allows users to start an independent instance of unicorn on
a the same port as a running unicorn (as long as both instances
use :reuseport).
ref: https://lwn.net/Articles/542629/
---
lib/unicorn/configurator.rb | 19 +++++++++++++++++++
lib/unicorn/socket_helper.rb | 30 ++++++++++++++++++++++--------
test/unit/test_socket_helper.rb | 8 ++++++++
3 files changed, 49 insertions(+), 8
2012 Oct 03
5
is_virtual selector
I too have been pushed into Puppet 3.0. Clients and PuppetMaster are now
at 3.0.0. Not sure if this is a version change or syntax error that I am
experiencing. We''ll use ''ntp'' as the example and the "build" host is a VM.
The old way:
class baseline::ntpd {
package { "ntp":
ensure => $virtual ? {
physical => present,