Displaying 20 results from an estimated 10000 matches similar to: "radio_button with boolean fields does not work with postgresql"
2006 May 31
2
Storing a NULL value from a radio_button
Hi, I''ve a boolean database field (tinyint(1)) wich allows nulls.
Then, I''ve something like this:
radio_button(''server'',''customer_has_login'',"NULL")
radio_button(''server'',''customer_has_login'',true)
radio_button(''server'',''customer_has_login'',false)
The problem is
2008 Dec 07
0
boolean button helper
I don''t have a blog, but wanted to share this little bit of code with
other semi-beginners like myself who are still learning to take
advantage of rails features.
Selecting an attribute with a boolean switch is a common pattern in
forms. You can do it with a check box, but radio buttons are more
expressive in some situations and better convey to the user that they
are making a mandatory
2006 Apr 04
0
radio_button in a loop not working
Hi!
I''m a RoR newbie and i''m trying to make this sample code work...
I must be able to choose whether or not to switch lights on/off (one
light per line)
<table>
<% @valeurs.each do |@v| %>
<tr>
<td>Light <%= Light.find(@v.light_id).nom %>:</td>
<td><%= radio_button(''v[]'', ''etat'',
2006 Jul 01
4
Radio_button in loop problem
Hi all, I can''t figure out why my radio_buttons won''t reflect the values
stored in my database. I read through some of the previous posts -- is
it true that they don''t work with integers?
This is the code I''m using:
<% for question in @survey.questions %>
<%= debug question %>
<%= radio_button ( "question", :question_id,
2006 Apr 06
1
Puzzled by "radio_button".
I have what seems like simple, working code:
<form action="save_dh_options" method="post">
<fieldset>
<legend>DH Work Reports</legend>
<p>Would you like to fill a work report?</p>
<p><%= radio_button("user", "enable_report", "yes") %><label
for="yes"> Yes</label><br
2010 May 19
1
Cannot have both select and radio_button together on the same form
Hello, I''m new to Ruby on Rails.
I am creating a form for searching purpose:
<% form_for :src_cond,
:url => {:action =>''search''} do |p| %>
<%= p.radio_button("bd", "1") %> a
<%= p.radio_button("bd", "2") %> b
<%= p.select :bd2, %w[1 2 3 4],{},{:index=>nil} %>
<%=
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 26
0
radio_button groups
For my first rails app, I''m building a web page that will list some
restaurants and then have the user rate them from from 1 to 5 using 5
radio buttons. The view code looks like:
<h3>Ratings:</h3>
<form action="save_ratings" method="post">
<table>
<tr>
<th>Restaurant</th>
<% for rating_option in
2006 Jan 12
4
Typecasting and boolean attributes
I have 2 radio buttons like this:
<%= radio_button ''group'', ''public'', true %>
<%= radio_button ''group'', ''public'', false %>
They hold the correct values when viewing the @group object. However,
when updating, it does not appear that the params[:group][:public]
value is being typecast correctly.
As
2011 Nov 20
3
Use Ransack with radio buttons for boolean values
Hello
I''m trying to search for active and non active users. These radio buttons
work just fine except that it didn''t reselect itself after the form has
been submitted. So, what should I do to ensure it will be selected just
like how my text field populated automatically after the form has been
submitted?
= search_form_for @q do |f|
= f.radio_button :is_active_false, 1
=
2006 Apr 20
7
Rails + postgres case insensitive searches.
Hello all
I am wondering how rails handles case sensitivity in databases. If I
do a Person.find_all_by_name("tim") in mysql I would expect to get
tim, TIm, and Tim. Do I only get tim in postgres?
How do other people deal with this? Do you resort to find_by_sql for
all your postgres queries to get case insensitive results?
2005 Mar 07
2
radio_button helper and "checked" option
Does anyone know how to get the radio_button helper to set the html
"checked" option?
Thanks,
Curt
2006 Jan 04
4
radio_button method does not recognize int values?
So the api listing says that radio_button(object, method, tag_value,
options = {}) gives a radio button tag, and if object.method ==
tag_value, then the button will be checked.
I verified the method behaves correctly for attributes of type string.
However, if the attribute is of type int, it doesn''t make the button
checked.
Does anyone have some information before I file a bug?
Some
2006 Aug 04
2
observe_field for radio_button
Hi,
I need to observe a set of radio buttons but am having great trouble. My
observe_field looks like this:
<%= observe_field :user_select, :frequency => 0, :url => { :action =>
:admin_control } %>
Now it works fine if I use a text_field like this:
<%= text_field :user, :select, "size" => 20, "maxlength" => 16 %>
But I want a radio button, and
2006 Apr 04
1
using form_remote_tag and radio_button
I want the user to select a date using radio buttons. The following
code shows the last 7 days.
<%= form_remote_tag(:update => ''register_order'',
:url => { :action => :register_orders } ) %>
<% 1.upto(7) do |i| %>
<%= radio_button "date", "register_date", i.days.ago.strftime("%Y-%m-%d") %>
2011 Aug 09
4
Nesting select and text_field in radio_button
I''m creating my first Rails app and need an idea creating forms.
I have Meeting model with place attribute.
I want to have two fields for Meeting.place = one would be select with
places from other meetings or text_field if the place is being used
first time. User would be selecting radio_button of which field he has
used.
So is there any way to nest select and text_field within 2
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 Sep 18
1
Sorting Boolean fields
Hey there,
I came across this thread: http://www.ruby-forum.com/topic/78148#126235
where sorting in reverse by a boolean field wasn''t working properly. I''m
having the same issue now, but there''s not a reply in that thread. I was
wondering if anyone has figured this out yet?
Bascially, I want all the records with a "1" (true) to float to the top
of the
2006 Aug 16
0
validates_presence_of non-null float/boolean/integer fields
Has anyone figured out a way to get validates_presence_of to work with
float, boolean, and integer fields that are defined as non-null in the
schema?
The problem is, ruby intializes these types to the default schema value,
which for mysql is never null if the column is not allowed to be null,
and as a result they are initialized in the form with a value, and are
never null.
I found a work
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?