Displaying 20 results from an estimated 9000 matches similar to: "Null Text Fields"
2008 Sep 05
1
boxplot including null info from dataframe, not with SQLite dataframe
I have been trying to use R to gather some information from parsed log
files (as part of examining some performance issues). I parsed the
log files and put the data into an SQLite database, and then used
RSQLite to load the data into R. The fields of interest are
controller, action and total_time: controller and action have string
values; total_time has a decimal value.
I first did the
2008 Sep 11
2
database table merging tips with R
I have not devoted time to setting up ROracle since binaries are not available and it seems to require some effort to compile (see http://cran.r-project.org/web/packages/ROracle/index.html). On the other hand, RODBC worked more or less magically once I set up the data sources.
What is your success using ROracle and why would it be preferable to RODBC ?
-Avram
On Thursday, September 11,
2006 May 03
2
Using a helper within another helper?
I am trying to push some view logic into a helper. The thought is that
this is a step towards having the business logic in the helper rather
than the view. However, I''m essentially wrapping the checks around an
eventual call to date_select(). The problem I''m having is that the
application complains that it doesn''t know about date_select(). I''m
sure (or
2006 Apr 27
3
Removing a default value for a foreign key with not null set
Hi all,
For various reasons I need to have foreign keys with not null constraints.
Eg:
create_table :people do |t|
t.column :name, :string
t.column :household_id, :integer, :null => false
end
create_table :households do |t|
t.column :name, :string
end
add_foreign_key_constraint :people, :household_id, :households, :id
So the people table has a foreign key into
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2007 Mar 06
15
mocking missing methods
Hi folks.
So I''m using mocha on a ruby project, and I really like it. One thing
I''ve noticed is that it can be a bit "surprising" when I''m mocking
methods that don''t exist on an object, and I think there''s an easyish fix.
At the moment, you use sheep = mock() to create a mock sheep. What I''d
like to do is something like sheep =
2009 Jun 24
2
At my wits end ! Controlling passed in negative values from a form
Hi,
I am trying to validate a numeric value passed in from a form, which
is saved in a MySQL db as decimal(9,2)
Now problem is I need to ensure people don''t enter a form value like -.
003. In my validations, I have a validates_numericality_of check being
done. Furthermore, in validate method, I have a check using an if
statement such as :
((an_object[n].nil? or an_object[n] < 0) and
2012 Jan 21
4
why doesn't an instance of Object get Class's new instance method?
"Object is the root of Ruby''s class hierarchy. Its methods are
available to all classes unless explicitly overridden."
Wouldn''t Class class be at the root of the class hierarchy?
After all, look at this:
1.9.2p290 :006 > Object.instance_of? Class
=> true
Object is an instance of class, after all we can use one of Class''
instance methods on Object:
2012 Nov 10
6
Suggestion: `before_save on: :create` should either work or raise an exception
There''s a small inconsistency in ActiveRecord''s callback syntax that has
tripped me up before. It wouldn''t be a big deal, but it can lead to a
silent failure. I''d like to suggest that it either be made consistent or be
made to fail loudly.
The issue is that to do something before validating, but only when
creating, you use `before_validation on: :create`,
2012 May 26
2
before_create is after_validatation :on => :create , when it should be before_validation :on => :create
In ActiveRecord''s callbacks, methods within a before_create callback
are called after the validation, but before the model is created.
This was an intentional design decision, but I think it was the wrong
one. What do you think?
When I think of before_create, I think of before_validation :foo, :on
=> :create, but, by default, before_create is synonymous with
after_validation :foo,
2006 Apr 05
4
validates_format_of ?
Hi all,
I''ve got a form which accepts a "price" field and I''m attempting to
validate it and allow some flexibility in the way the user enters it.
It''s a numeric field but I want the user to be able to enter dollar
signs and commas naturally in the data entry.
I''m trying to understand how to use validates_format_of, and I''m not
sure what
2006 Mar 24
1
Problems with before_validation
Hi all
My visitors can create party organisator profiles, and I want assign
them as the creators (the field creator_id in the organisators table
references a member in the members table).
To do that I tried it with before_validation:
def before_validation
creator = Member.find 1
end
Sadly, this does not work. The validation
validates_presence_of :creator_id
Still tells me, that
2011 Jun 19
1
before before_validation callback
Hi,
I was looking around a bit and couldn''t find any callbacks that
executed before before_validation
The current problem with using before_validation is that it won''t fire
if I''m not using validations with #save(:validate => false) - which
makes sense. Before_save won''t suffice because I want these callbacks
to fire before validation on the occasions that
2006 Nov 19
2
underscores, sugar, and more and more bugs
I sent this earlier under with the subject "artificial sugar causes
cancer" and I think some spam filters ate it. Here it is again:
======================================
All,
If you look at http://rubyforge.org/tracker/index.php?func=detail&aid=6760&group_id=797&atid=3149
you''ll see that Chad (the submitter) found the source of the bug.
Unfortunately, the source
2006 Nov 19
6
artificial sugar causes cancer
All,
If you look at http://rubyforge.org/tracker/index.php?func=detail&aid=6760&group_id=797&atid=3149
you''ll see that Chad (the submitter) found the source of the bug.
Unfortunately, the source of *this* bug is the *solution* to a
*previous bug* in which Rails was replacing RSpec''s method missing
with its own.
When we settled on underscores, my one reservation was
2010 Aug 29
4
Wrong class being returned in association
I''m using Rails 3.0.0rc and have the following models:
class User
has_many :readings
has_many :conversations, :through=>:readings
end
class Reading
belongs_to :user
belongs_to :conversation
end
class Conversation
has_many :readings
has_many :users, :through=>:readings
end
and this controller code:
class ConversationsController
def show
@user =
2006 May 02
4
useful bit of code (hopefully)
Hi,
I often find myself using bits of code like this inside ActiveRecord,
perhaps it''s useful for others, or others can improve on it:
###########
# fix user input before validating it
before_validation :sanitize_input
# santize input before actual validation is called
# this uses the little methods defined below
def sanitize_input
trim %w(adres postcode woonplaats email naam
2013 Aug 27
11
Why NaN.class throws NameError ?
Here is my sample code:
class Foo
Bar = 10
end
Foo::Bar # => 10
Foo::Bar.class # => Fixnum
10.class # => Fixnum
Float::NAN # => NaN
Float::NAN.class # => Float
NaN.class
# uninitialized constant NaN (NameError)
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2010 Jun 25
3
Best practice for removing leading and trailing whitespaces
I want to remove the leading and training spaces for most of the
resources in my rails application
For a new POST request, rails does the xml parsing and passes the params
hash to the controller. Some of the parameters have leading and/or
trailing whitespaces which are causing problems (e.g. new resources
being created rather than using the old ones). I don''t want to put the
code in all
2006 May 09
11
model filter?
Hi All,
Is there a way to filter / modify the output of a model class before
it''s returned to controller/view that''s calling it?
Example: I have a field phone_number which I always want to preformat
using the number_to_phone() helper....
Any help is appriciated.
Thanks!
--
Posted via http://www.ruby-forum.com/.