Displaying 20 results from an estimated 600 matches similar to: "changing find method"
2008 Mar 07
3
Boolean circles..
Hi,
This is just kindof a RoR question, but since you all potentially do
the same things as I do, I thought I''ll ask here..
Im trying to use the boolean type in the database. Migrations is no
problem, it even converts the 0/1 values from my import CSV to false
and true.
However, I cannot make the :conditions part of a find work:
Loading development environment (Rails 2.0.2)
>> c
2009 Dec 28
2
Override .find, .find_by_id, etc...
I read these:
http://www.ruby-forum.com/topic/185297#new
http://www.freezzo.com/2008/05/14/override-default-find-conditions-for-model/
it works, it override the .find perfectly, however it does not cover
.find_by_id or other .find_by_XXX
Is there anyway to override all the find function of a modal? I want to
set the default "select" for User modal, only return name and id, but
not the
2006 Jun 23
1
''Series'' Pluralization
Howdy,
I have a model I called ''content_series''. I created it and noticed that
Rails called it ''Sery'', so I added ''series'' to the uncountable thing in
the config, like this:
Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, ''\1en''
# inflect.singular /^(ox)en/i, ''\1''
#
2009 Jul 20
2
Hitting unknown error with "can't dup NilClass"
Hi,
My system has been encounter this problem, and I couldn''t find
solution after debugging. My scenario is stated below:
class user
has_many :posts
has_many :comments
end
class post
belongs_to :user
has_many :comments, :as => :commentable
end
class comment
belongs_to :post
belongs_to :user
end
For this case, I am trying to retrieve each post''s comment
2006 Aug 07
0
Overloading ''find''
How would I overload find?
I got some excellent help on mixins for my classes using lib/, but it
doesn''t allow find to be overloaded. I''m testing with the example method
below:
module myModule
def find(*args)
options = extract_options_from_args!(args)
validate_find_options(options)
set_readonly_option!(options)
case args.first
2009 Jun 23
2
syntax error, unexpected tINTEGER, expecting $end
Please help me solve the following error message:
syntax error, unexpected tINTEGER, expecting $end
I have this model:
Code:
1. class GeoDatum < ActiveRecord::Base
2. end
The database contains the table geo_data, which contains the zip_code
column, filled with zip codes. I get the above error when searching
for a zip code and the zip code exists in the table. Here is the
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
I submitted this earlier, but the web forums went down and I''ve screwed up
the thread, so I''m starting over.
I''m trying to built a document upload system. The system has a main
Document model with different subclasses for different types of documents.
With the code below, if I attempt to create a Document, it works fine, but
if I attempt to use one of the subclasses, I
2007 Jun 11
3
ActiveRecord::StatementInvalid error
Hi,
I have an application that is running fine on two different machines,
but when I ported the code to a third machine, it doesn''t seem to
work. More specifically, for users with a significant amount of info,
it seems to stop working. All the functionality seems to be working
properly on a small test set, but with a larger set I get the
following error:
AssociatedAp Load (0.000000)
2006 Jul 03
6
help!
Hi,
i''m fairly new to ruby on rails, and i know the question at hand may
seem simple at first, but i''m getting really caught up in trying to
understand this and the docs aren''t giving me answer. i actually thought
i knew how the sql commands work (like :include, :conditions, :etc) but
obviously, i don''t.
there are three models M1, M2, M3 joined by a habtam
2006 Jun 19
3
can''t dump anonymous class Class
I''m trying to create a document upload system, where most of the code is
the super class Document and just the path to file on the system is
controlled by the sub classes. When I attempt to use my code, I get the
following when I try to save the document.
can''t dump anonymous class Class
Any ideas?
** Migration **
class CreateDocuments < ActiveRecord::Migration
def
2009 Sep 14
9
ActiveRecord::StatementInvalid (invalid date) with Oracle
Hello all. I am a novice Ruby on Rails programmer, starting my first
project using a legacy Oracle 10 database. Using ''reverse_scaffold'' I
have created the models/controllers/views for my existing Oracle
tables.
All seems to work well, using /model/index, /model/show for most of my
tables, *except* when one of the tables contains a Oracle ''date''
column, for
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
2006 Jun 02
7
Unit Tests crashing out for a table without an ID
I''m having problems unit testing my model- I have a kind of quiz
functionality user table and a question table and a
user_question_response table that contains the id for the user, the id
for the question and the user''s response. The user_question_response has
it''s own model belongs_to/has_many with users and questions and it works
fine in the actual application but
2006 May 11
0
Handling instantiate_without_callbacks
Hi,
I''m writing this app with inheritance. I''m using the type column to
store the class name. Another app scans the app and performs actions.
However, it is possible that the second app does not implement a
class, in which case, the superclass should be instantiated. Now I''m
getting:
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/
2007 Oct 07
0
Rails AR/Oracle Unit Test: [7769] failed (getting worse)
"bitsweat" has kicked AR/Oracle while it was down...
http://dev.rubyonrails.org/changeset/7769
------------------------------------------------------------------------
r7769 | bitsweat | 2007-10-06 22:29:37 -0700 (Sat, 06 Oct 2007) | 1 line
MySQL: speedup date/time parsing.
------------------------------------------------------------------------
U
2006 Mar 28
12
cached-model broken with Rails 1.1
It looks like cached-model is broken again under rails 1.1. Can anyone
confirm? Note that the exception below indicates it''s trying to treat
CachedModel as the class name of the model, rather than using the proper
class name (which is Entry in this case, and the table called entries).
This is a model using Single Table Inheritance and acts_as_tree, and
worked just fine under 1.0 and
2006 Mar 29
0
Intermittent error - undefined method ''destroy_without_callbacks''
When testing my app locally I''m getting intermittent errors which are
driving me mad!
The error is:
NameError ((eval):1:in `alias_method'': undefined method
`destroy_without_callbacks'' for class `Exercise''):
Refreshing the browser sometimes fixes it, as does restarting WEBrick.
Annoying to debug as it only happens intermittently.
Any ideas on why this is
2012 Oct 30
3
boxplots of various levels
noob here
trying to make boxplots of some data
i would like to separate the boxplots according to conditons of various
levels
for example:
i have
group:1 and 2, each group performed tests consisting of
condition A,B,C,D
side: left and right
time: 1 to 10
I would like separate boxplots of the results (x) of the tests (numeric) for
each group under each condition on each side over time.
so far i
2011 Mar 21
3
unbreak vfork on cris architecture
Hi klibc people,
if someone has to say more on this, please do so. I?m only trying
to explain what I _think_ I learned?
>Begin forwarded message originally by Mike Frysinger:
>> On Mon, Mar 21, 2011 at 10:24 AM, Waldemar Brodkorb wrote:
>>> unfortunately the common vfork implementation, which just use
>>> the syscall function to interact with the kernel, does not
2006 Feb 05
1
return yr/mo archive of posts
looking at ways to return an archive, by year/month
in the past, (via php) i''d do something like pull all the entries,
ordered by date and iterate through them, doing a check on the month and
year and adding them to an array if there was a change
that method doesn''t really feel very fluid or rails-like.
any suggestions?