similar to: nil instead of empty string

Displaying 20 results from an estimated 10000 matches similar to: "nil instead of empty string"

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
2006 Feb 02
1
allow_empty instead of allow_nil
Is trhere any way how to support allow empty? Rails prefer empty string than null for database and then validations with allow_nil fails. -- Posted via http://www.ruby-forum.com/.
2006 Apr 25
2
Noob Question: Regarding Form
I''m hoping there''s an easy way to do this.  I''m trying to read options from a database, and insert them into form tags.  So for example, In the Database Table: options size: 300 type: text_field maxsize: 300 and I want to create a text_field form tag, with all the appropriate options, is there an easy way to do this, other than having the code output the HTML
2005 Mar 10
2
Newbie question - form validation
Hi, I am sorry for maybe stupid question. I am new in rails. I am trying to create very simple weblog systeme. I know threre are plenty of them, but It''s good to study. I create following rule in models/post.rb validates_length_of :header, :in => 3..50, :allow_nil => false, :message => "At least 3 characters" It''s working fine with default scaffolt add
2005 Dec 27
0
Edge Rails idea -- was [DRY relative to edit and show]
Just got around to understanding your idea Rich. Your idea seems to apply to every controller with new/edit/show views, so I think this is a better idea for the edge rails folks to implement generically than for a newbie like me do as a one-off. Thanks Greg On 12/23/05, Rich Clingman <Rich-xT5DcnBKZlNBDgjK7y7TUQ@public.gmane.org> wrote: > > > It would be nice if rails had a
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
2005 Dec 30
1
simple one-to-one relationship question
Hi all, In my shop application I have created a form (rhtml file) containing both address and order information. I created my fields: like the following: For address info: <%= text_field ''address'', ''postalcode'' %> For order info: <%= text_field ''order'', ''email'' %> However when the following action gets
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
2008 Jan 11
0
the parameter is nil ?
Hi, I use scaffold to create the task model controller and view, it contains action as "show", "new", "create", etc. Then, I give an "id" parameters to the view - new.rhtml, so the URL could be like "http://localhost:3000/tasks/new/1" , and I wish when I click the create button in "new.rhtml", the following "create"
2006 Jan 11
0
error_messages_for >> Cannot convert Array into String
Hi all I have the following Model: Member(id, username, first_name, last_name, hashed_password, password_salt) Now I want to allow users to register for an account using the following form: --- <%= form_tag %> <%= error_messages_for ''member'' %> <p><%= _(''Username'') %>: <%= text_field(''member'',
2005 Dec 27
0
Re: RESOLVED: Overloading error_message_on method in ActiveRecordHelper
Leaving the body of the method the same as the default still throws the "stack level too deep" error. As a matter of fact, it only disappears if I comment out the ''require'' in line 1. As it turned out, it was the method definiton itself that caused problems. Ruby doesn''t have keyword arguments, but I tried calling the method as if it had. But when I changed
2007 Nov 20
1
:allow_nil validation vs. blank?
I think I must be doing something wrong... when a form returns params to the controller, empty fields appear to be returned as blank, not nil. so what''s the point of an :allow_nil=>true setting on a validation? it fails because blank is not the same as nil. i would expect either returned empty fields to be nil, or :allow_nil to really be :allow_blank. otherwise i have to do a search
2006 Nov 04
0
Validations ignoring :allow_nil => true
I have an address model and am doing some validations. One of them seems to ignore :allow_nil => true. If I leave the phone input blank, I get it back with a "too short" error. Here''s the relevant parts of the model: 1. class Address < ActiveRecord::Base 2. 3. validates_length_of :phone, :in => 7..10, :allow_nil => true 4. 5. before_validation
2006 May 18
1
Patch 5091
Hi, I submitted a patch (for the first time) a couple of days ago (http://dev.rubyonrails.org/ticket/5091 - the decsription is included below). I''ve noticed some posts to rails-core notifying the world of patches, since there''s been no activity on said patch I thought I''d do the same. Please let me know if this breaks protocol. Cheers, Ian White --- patch summary
2005 Dec 25
2
[repost] newbie questions
Hi all, I''m following the shop example in ''Agile Web Development with Rails''. I would like to extend the checkout screen, in such a way people can change the number of items they have selected in there cart. In my controller I have: def checkout @cart = find_cart @items = @cart.items if @items.empty?
2011 Sep 21
1
Dovecot failing to parse some UTF-8 encoded attachment filenames, returning empty string instead
Hi, I'm seeing a strange problem with some attachment filenames that are UTF-8 encoded. The problem seems to be related to spaces and/or unusual characters in filenames, like accented characters (or perhaps just to filenames if UTF-8 encoded; I've not explored that fully). These filenames are shown as empty strings in IMAP using Dovecot. I've attached a sample message that exhibits
2009 Jul 29
6
Doubt in nil object with ajax
hi this is my htnl <html> <head> <%= javascript_include_tag :defaults %> </head> <body> <%= form_tag nil, { :id => ''search_form'' } %> <%= text_field ''recipe'', ''name'' %> <%= end_form_tag %> <div id="recipe"> </div> <%= observe_form :search_form, :frequency =>
2005 Dec 21
0
help with sending email form
Hello, I have an email app running where I can send an email. How do I pass form data to my email notifier? here is my code that is not working. <%= start_form_tag :action => "index" %> <% if @flash[''notice''] %> <div class="Message"><%= @flash[''notice''] %></div> <% end %> <p> Please enter
2005 Dec 23
0
newbie question
Hi all, I''m following the shop example in ''Agile Web Development with Rails''. I would like to extend the checkout screen, in such a way people can change the number of items they have selected in there cart. In my controller I have: def checkout @cart = find_cart @items = @cart.items if @items.empty?