Displaying 20 results from an estimated 500 matches similar to: "Dynamic finders in has_many associations"
2008 Aug 10
1
R function, sink() and empty file
Dear all,
I wrote a simple script in order to put together some functions and method
to be executed on various files
I am trying to have to possibility to call the script changing few
parameters in order to use the different files.
I succeeded partly using the function method.
However in my script I call the sink() function in order to output the
results to a .txt file. When using the function the
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
2017 Jul 22
0
Compaq R3000h support
Now I have some access problems.
This is what ends up un messages
Hosts.allow is set to accept anyone on the local net.
Username and passwords are the same
Upsc gives proper output.
System is Centos 6.8
Jul 22 17:20:06 BIFROST upscode2[10113]: Startup successful
Jul 22 17:20:06 BIFROST upsd[10116]: listening on ::1 port 3493
Jul 22 17:20:06 BIFROST upsd[10116]: listening on 192.168.0.1 port 3493
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
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 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 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!
2005 Dec 21
0
Dynamic Finders and 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
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
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
2006 Aug 14
2
finders et sous-classes
Bonjour, c''est ma premi?re question ici car d''habitude il me suffit de
parcourir de tels forum pour trouver r?ponse ? mes questions.
Donc cette fois, c''est du s?rieux, je n''ai pas r?ussi ? trouver la
moindre ?vocation ? mon probl?me.
Je vous explique.
J''ai une famille de mod?les :
class Attachement < ActiveRecord::Base
...
end
class Illustration
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
2017 Jul 22
2
Compaq R3000h support
On Sat, Jul 22, 2017 at 7:48 AM, Charles Lepple <clepple at gmail.com> wrote:
>
> I also have not used a Synology device, but as I recall, they generally
> expect to be the NUT master system. This may cause problems if you need to
> do something fancy with upssched.
>
The Synology boxes work fine as NUT clients, *however* they provide very
little ability to configure NUT
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
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless
2013 Mar 12
5
XSA-36 / howto fix broken IVRS ACPI table
Hello,
since applying the patches related to XSA-36 Xen recognizes a broken IVRS ACPI
table and disables I/O virtualisation.
I contacted the manufacturer of the mainboard/BIOS and they want to help me by
providing a patched BIOS - so far so good.
However, they need details about what to fix, which I don''t know either.
Could you pls. give me some hints which I can forward to the
2013 Sep 12
3
[PATCH 1/1 V3] x86/AMD-Vi: Add additional check for invalid special->handle
From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
This patch handle additional cases for IVRS bugs where special->handle
is not correctly initialized for IOAPIC and HPETS due to firmware bugs.
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Provide logic in "is_ioapic_overidden()"
Signed-off-by: Jan Beulich <JBeulich@suse.com>
---