Displaying 20 results from an estimated 3000 matches similar to: "Dynamic Finders and Legacy Schemas"
2006 Jan 05
8
Repost - Do dynamic finders work with legacy schemas?
Hello everyone,
I have another question related to a legacy schema I am working with.
Do dynamic finders work with legacy schemas in general? The schema I am
working with uses hungarian prefixes for column names. For example fOpen is
0 if a bug is closed and 1 if it is open (type smallint). When I try @bugs
= Bug.find_all_by_fOpen(1), I get the following exception:
undefined method
2008 Sep 23
0
Questions on Active Record SQL type Finders & Dynamic Finder
Hi,
I understand there are total 11 types of key Options for finding a
record.
The all 11 valid keys for the options hash are :conditions,
:include, :order, :select, :group, :joins, :from, :limit, :offset,
:readonly, and :lock.
We also have Dynamic Finders for the same. e.g. ... find_by etc...
I would like to know, how many types of dynamic finders, Active Record
provides, to match all those
2008 Feb 07
1
field names, aliases and finders.
I can not seem to make finders work with aliases. My goal is to map
some fugly field names to nice field names and have the finders work
with the nice field names.
An example.
class Users < ActiveRecord::Base
alias :password :UserPWD
end
This doesn''t seem to work because obviously the object doesn''t have a
method called UserPWD.
What is the best way (short of a view) to
2006 Jan 11
0
Issues with dynamic finders ruby-1.8.4 / rails-1.0.0
Hi all,
I am not certain this is a 1.8.4 related issue, but I think it might be.
I''m trying to use dynamic finders for my Category and Post models,
such that a request /blog/categories/general would detect the slug and
do a find_by_slug() instead of find(params[:id]).
My have_slug?() method works fine, and the dynamic finders *were*
working fine until I moved it off my local machine
2006 May 30
0
:limit option in schemas/migrations
There''s some confusion as to what the :limit option should mean when
used against integer columns in migrations.
Patch #2900 added support for limits in PostgreSQL mapping mapping
limit < 4 to smallint, > 4 to bigint, and anything else to integer (so
the limit is the number of bytes)
However, the mysql adapter uses limit to specify the ''display width''
in digits,
2007 Oct 26
1
Spec custom finders
I have some finders in my models where I write some of the sql myself. I
of course want to test these, but am not sure the best way. Should I just
let them roll through to the db, and verify they return the correct
objects based on the fixtures I load, or should I spec the actual query? I
know that DB access is sort of frowned upon, but is this a situation where
it is more or less acceptable? My
2009 May 19
0
Extending finders to include a session variable as an option??
We have a Page model which acts_as_paranoid.
AAP modifies ActiveRecord finders to ignore any records marked as
deleted unless the :with_deleted => true option is supplied.
We have a UI element which allows users to toggle whether or not to
display deleted Pages, their current setting being stored in a session
variable, session[:show_deleted].
What we would like is to automagically have
2012 Jul 25
0
help about quota config
hi all :
mysql mailbox below :
CREATE TABLE `mailbox` (
`username` varchar(255) NOT NULL DEFAULT '',
`uid` varchar(255) NOT NULL DEFAULT '',
`password` varchar(255) NOT NULL DEFAULT '',
`clearpwd` varchar(128) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`mailhost` varchar(255) NOT NULL DEFAULT '',
`maildir`
2008 Apr 24
2
Dynamic finders in has_many associations
I have these 3 models.
class Ivr < ActiveRecord::Base
has_many :klusterings, :dependent => :destroy
has_many :klusters, :through => :klusterings, :uniq => true
end
class Kluster < ActiveRecord::Base
has_many :klusterings, :dependent => :destroy
has_many :ivrs, :through => :klusterings, :uniq => true
end
class Klustering < ActiveRecord::Base
belongs_to :kluster
2011 Aug 23
2
Where is WillPaginate::Finders ???
Hi All!
It''s been a while since I had to ask for help, but I''m back!
I''ve finished beta testing my big app and started the transition to
production. Everything went fine and the production version was working
till I was asked to add another model :-( (Almost a year of beta
testing and they only come up with it after moving to production :-D )
I successfully
2004 May 10
3
sqlSave with underscores in table fieldname
Hi group,
I try to write a frame to a table (RODBC). I use
colnames(temp6) <- c("ind_id","ser_id","period_id","year","calc","mean")
sqlSave(channel, temp6, tablename = "series_indices_test",append= TRUE, rownames=FALSE, verbose = FALSE, test = FALSE, nastring = -999999, fast = FALSE)
This is giving me an error:
Error in
2006 Feb 22
0
Realtime queues with Firebird SQL through unixodbc
Hello,
I have a partially working Realtime Queue using unixODBC and Firebird. I
followed the steps on asterisk-guru and the voip-info asterisk message
boards but have been having no success.
I say that my queue is partially working because callers can join the
queue. However the calls do not go to the agents even if the agent is
not tied up and is available for calls. So the caller is stuck
2008 Jan 09
0
Beginner: How to use data from external Database
Hi,
im new to RoR so sorry if the questions sounds stupid to you.
Im trying to build a tool for a browsergame.
The game allows access to its database and the db looks like this:
table villages:
`id` int(9) unsigned NOT NULL default ''0'',
`x` smallint(3) NOT NULL default ''0'',
`y` smallint(3) NOT NULL default ''0'',
`tid` tinyint(1)
2006 Jul 26
1
Polymorphic Associations: dynamic finders
Is there any sort of dynamic finder for polymorphic associations?
For example if I had:
class InviteNode < ActiveRecord::Base
belongs_to :inviteable, :polymorphic => true
end
I would like to be able to search by:
InviteNode.find_by_inviteable(some_object)
instead of having to do:
InviteNode.find_by_inviteable_id_and_inviteable_type(some_object.id,
some_object.class.name)
obviously I
2006 May 10
6
Migrations don''t really support transactions
I read in various places that although migrations aren''t transactional, all
you need to do is wrap you migration method in "ActiveRecord::
Base.connection.transaction do"
to make the self.up or self.down transactional. In my experience (Rails +
PostgreSQL), this doesn''t work very well. If my migration hits an
exception, any tables that were touched remain modified.
2006 Jun 20
3
return unique rows with finders
I''m looking through the api for something like find(:all, :distinct => true)
so that multiple instances of a row won''t be returned - is this possible?
Thanks!
2006 Mar 08
0
Unit tests dynamic finders
Hi all,
I am having a problem with unit tests. Whenever I have a dependency
between two models (B depends on A) deleting A should also delete B.
This is simple with the dependent parameter in the model file of A. But
when I write a test the dependency seems to work, I can''t find the
answer with id 1 anymore(Answer.find(1)). But I appearently _do_ find it
with
2006 Mar 14
1
Dynamic Finders with _or_create Don''t Work?
What could cause this?
>> sdfl=PartNumber.find_by_part_number("1111111")
=> #<PartNumber:0xb78fc744 @attributes={"id"=>"11601",
"part_number"=>"1111111"}>
>> sdfl=PartNumber.find_or_create_by_part_number("1111111")
NoMethodError: undefined method `find_or_create_by_part_number'' for
PartNumber:Class
2012 Jul 17
1
AR deprecated finders
Hi all,
I had troubles while running tests on Active Record:
bundle exec rake test_sqlite3
/Users/oscardelben/code/rails/activesupport/lib/active_support/core_ext/hash/keys.rb:70:in `block in assert_valid_keys'': Unknown key: extend (ArgumentError)
This is because some models used by tests are using the extend option which now seems deprecated.
Should related tests be
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