Displaying 20 results from an estimated 20000 matches similar to: "Saving boolean attributes"
2006 Mar 10
6
boolean select problem
I want to use select form elements to choose between boolean options. How
can I have it default to true and still display the persisted value (either
true or false) when editing an existing object? I guess booleans default to
false by default so its not obvious how to recognize when it''s a real
''false'' that the user set or default false because the value was null.
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 Feb 28
6
How To Validate Boolean Form Field
Hello all.
I''ve got the following in my model:
class Individual < ActiveRecord::Base
validates_presence_of :first_name, :last_name, :street, :city,
:state, :zip
validates_acceptance_of :AZ_resident, :message => "You must be an
Arizona resident."
end
The AZ_resident field is present and defined as boolean (PostgreSQL
8.1), but validation will not occur.
2006 Mar 01
4
another select_list question - bad bad booleans
I have a select list for a boolean column in postgresql
in the ''model'' ...
YES_NO = [
[ "Yes", "1" ],
[ "No", "0" ]
].freeze
in the ''view code'' ...
<%= options = [[''Accepted?'', '''']] + Placement::YES_NO
select("placement", "accepted",
2008 Feb 05
2
lctl deactivate questions
Hi;
One of our OSTs filled up. Once we realized this,
we executed
lctl --device 9 deactivate
on our fs''s combo MDS/MGS machine.
We saw in the syslog that the OST in
question was deactivated:
Lustre: setting import ufhpc-OST0008_UUID INACTIVE by administrator request
However, ''lfs df'' on the clients does not show
that the OST is deactivated there, unless we *also*
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?
2017 Jul 14
2
failing to optimize boolean ops on cmps
Going back to the original problem. Why shouldn't
SimplifyUsingDistributiveLaws handle both these cases?
For the bitwise test case if you distribute you get
(~A | A) & (B | A)
The left side of that simplifies to all 1s which is the identify value for
and. So even though the right side doesn't simplify it's a win.
~Craig
On Fri, Jul 14, 2017 at 11:46 AM, Hal Finkel via llvm-dev
2006 Oct 09
1
[PATCH] dbus terminate action
I was always annoyed that you couldn't terminate an action with dbus so
I have
written this patch which fixes that. Hopefully this can be included.
I wrote the patch trying to repeat as little code as possible so I just
added a boolean
parameter to the dbusHandleActivateMessage and changed the name to
dbusHandleActivateDeactivateMessage. You could probably change the
deactivate
parameter
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
2006 Feb 12
6
Design question - where to store constants?
Let''s say I create a "ticket system" that has a support ticket with a
status attached to it. (Say, OPEN or CLOSED for now, but more later)
The status -could- be another table in the database listing status
types, but I think that''s unnecessarily complex and overly flexible for
this. (opinions on this point would be interesting)
Another alternative would be to
2006 Feb 09
17
complicated finds are eating my sole
I abandoned ruby way for find_by_sql and still can''t get this...
@myplacement = Placement.find_by_sql(
"select * from placement where
:intake_date >= beg_intake_date
and
:intake_date <= end_intake_date")
just a simple date range...it''s killing me - If I knew how to load
placement controller into irb, I could probably try out finds
interactive mode...
Thanks
2006 Feb 23
13
Check if a saved user''s name is admin
Hi all,
I have a question about this method in my User model:
# Returns true for the (saved) user called "admin"
def is_the_administrator
true if save and name == "admin"
end
The method returns true if the user''s name is admin. However, I only want to
return true if the state of the object is "saved", so I call the save method
first.
I''m
2005 Oct 03
3
Boolean quoting, postgresql
http://dev.rubyonrails.org/ticket/1117
I''ve attached a patch to ticket 1117 which fixes it so that booleans
are escaped as booleans, not integers. Specifically, this situation
will now work
find_all(["send_date=? and sent=?", Date.today, false])
Which matches peoples expectations, but it causes some problems with
the postgresql unit tests. Specifically, the use of
2006 Jul 17
6
DRY? Converting Boolean to Yes/No
I have a database column given as:
t.column :change_address, :boolean
The user interacts with this using a checkbox, 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
2008 Dec 20
9
Upgrade to Rails 2 - problem with "save" (MySQL boolean issue?)
I have been working through an upgrade of my 1.2.6 application to
2.2.2.
I am almost there but I have hit a problem with ActiveRecord.
Before the upgrade, the following code was working fine.
def create_root(administrator)
root = create_root_collection(self.pingee_name,
administrator,
2008 May 29
7
when is a boolean not a boolean?
Weird problem.. I''m new to rails and ruby... maybe someone can explain
what I am not getting..
Env: Mac OS X 10.5.3, Rails. 2.0.2, ruby 1.8.6 (2007-09-24 patchlevel
111)
A User class created using the restful_authentication plugin
A Company class (has lots of fields not really important to the
problem below)
Users can have many companies, entered into the User.rb model as one
would
2010 Jan 09
3
tinyint(1) and boolean
So i had a boolean attribute in my model which gets interpreted to
tinyint(1) in mysql by rails migrations. Now tinyint(1) accepts a
range in mysql and i want to change my boolean attribute to an
attribute which can accept 3 values(0,1,2).
I made the change to the view and when i post the form selecting the
selecting the value ''2'', it still gets saved as a ''0''.
2017 Dec 05
1
How to enhance the query performance for large boolean attribute
Hi all,
I am a new user to Xapian, and now we met such problem. In our case, a document has many attributes which is boolean value, for example( A, B, C ) , and our search query will use certain filter logic ( A == true and B == false ..) to combine with other search logic.
We use MatchDecider to implement the filter logic, and now we met some performance problem, because our self-defined
2018 Jul 19
1
choosing between probabilistic and boolean prefixes for terms
Hi all,
public-inbox allows searching for git blob names (e.g. "badc0ffee")
in patches. Initially, I chose to use add_prefix for probabilistic
terms, since I assumed it could be a superset of what boolean
searching offered. Unfortunately, it doesn't seem to be the case
because stemming is interfering.
So switching to boolean filtering seems to work; and it is
fine for mechanical
2013 Jan 26
3
Converting column of strings to boolean
Hi
I'm trying to convert a column of strings (nominal types) to a set of
boolean / binary / logical values. For example, in the column there is red,
blue, green and yellow. There are 100 rows and each has a colour. I want to
convert the column to 4 columns: red, blue, green,yellow and then either 1
or 0 put in the relevant row.
Thanks
--
View this message in context: