Displaying 20 results from an estimated 2000 matches similar to: "Polymorphic find_or_create bug"
2006 Apr 07
3
List of all Models
Anyone know a pretty way to get a list of all Models?
That is, a list of all classes which inherit from ActiveRecord:Base
I can''t seem to figure it out!
The best I''ve got is to list the /app/models directory... but, that is
*dirty*.
-hampton.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jul 31
3
Polymorphic associations and single table inheritance
Running into an interesting problem that at first glance appears to be a
bug in the AR association code. However, it''s explicitly coded this way
so I''m not so sure.
I have some code like this:
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
class Person < ActiveRecord::Base
has_many :addresses, :as => :addressable,
2006 Apr 24
3
Regex in HTML
So, I''m trying to write a nice bit of regex to handle finding anchor tags in
a bit of html.
This is what I''ve got....
/<[aA][^>]*>[^<]*<\/[aA]>/
I''m planning on using this with a gsub!.
Here is what it has to do....
<html><a href="http://stuff.com" class="link">Anything in here.</a></html>
As you can
2006 Apr 22
6
Friendly Reminder (OT)
Today, I had a tragic hard drive crash. I hadn''t updated anything to SVN in
two weeks.
I''m posting this here as a reminder to my beloved Rails community.
Everyone, right now..... make a backup of your rails work. Make sure its on
two disks. Many of you already do that automatically, but just make sure its
working.
Two near-release rails plugins were lost in the tragic crash
2007 May 26
1
make_resourceful 0.1.0 Release!
I am extremely proud to put the code up live for make_resourceful! I
have been astonished by the positive feedback I''ve been receiving
since our talk at this year''s RailsConf. So much pressure to get this
thing out!
If you haven''t heard about it... then check out my slides from
railsconf http://www.hamptoncatlin.com/assets/2007/5/21/make_resourceful.pdf
or listen to the
2006 May 16
5
Transactions in RoR
Hi,
Does anyone knows how to manage transactions in RoR.
Thanx
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the
views with tons of <% %> ?
Like this
<%= start_form_tag() %>
<%= text_field_tag(''category[title]'', category.title, {:size => 20,
:maxlength => 128}) %>
<% if not category.parent_id.nil? %>
<%= select("category", "parent_id",
Category.find(:all,
2008 Feb 22
2
marshaling ActiveRecord objects: how to unload associations?
I''m marshaling ActiveRecord objects, and I want them to be as small as
possible. How can I unload everything that can be reloaded from the
database?
If they''re marshaled before any of the associations are referenced
then the referenced objects aren''t dumped. But if the association has
been loaded, how can I unload it? AssociationProxy.reset doesn''t seem
to do
2006 Apr 13
8
DevTower Beta3 Release!
DevTower Beta3! (0.3)
I''m proud to announce some major changes and improvements to DevTower in
this beta release! First and foremost, DevTower is now a full plugin. Also,
DevTower works (only) with Rails 1.1.
==== ABOUT =====
DevTower used to synchronize the development of Ruby On
Rails applications with developers working simultaniously
on multiple systems with Subversion. DevTower
2006 Aug 02
1
ActiveRecord: find_or_create with has_and_belongs_to_many --
I am attempting to use find_or_create on a foreign table with a
has_and_belongs_to_many relationship with my current table. I am doing
the following:
term = school.terms.find_or_create_by_code("FALL06")
the queries in the log show the expected SELECT statement to query if
there is a join table record between the school and term with code
"FALL06":
SELECT * FROM term
INNER
2009 Oct 11
0
Nested Attributes and find_or_create
Hi,
I''m using the new Nested Attributes to edit my models. It''s a
complicated relationship between 5 different models which are subclassed
from a ''Metadata'' model. They all have has_and_belongs_to_many
relationships with the model I am trying to edit.
Unfortunately when I add a new nested attribute, it creates a new row in
the database. I need it to check up
2010 Jul 12
0
[Patch][Issue #5097] attributeless find_or_create/find_or_initialize
This patch relaxes DynamicFinderMatch to recognize find_or_create /
find_or_initialize without a trailing _by_attribute_list. I''ve found
this useful when the relevant attributes have already been built up
through a chain of associations or named scopes.
Please review, thank you!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2010 Mar 13
6
Find first or create
Is there any ActiveRecord''s dynamic finder that can allow me to find
first association or create it if it doesn''t exist. Something like this
(not this code is conceptual - it does not work!):
Comment.posts.find_or_create(:first)
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2007 Jul 24
9
will_paginate plugin doesn't work with Association Extensions?
I have:
class Post < ActiveRecord::Base
has_many :comments do
def published
find( :all,
:conditions => {:published => true} )
end
end
end
When in my controller I do
Post.find(:first).comments.published.paginate :page => params[:page]
I get an error
undefined method `paginate'' for []:Array
Is will_paginate supposed to
2006 Feb 24
6
Duplicate entry - how to check if an id exist before saving?
How do I check if an entry exists before saving?
Someone one told me to use the method find_or_create (or something like
that)
but it didn''t work because I think the version of rails that we have is
not the most recent.
I need a way to check if an id exists in the db before saving. Any
suggestions?
Thank you
--
Posted via http://www.ruby-forum.com/.
2006 Apr 06
8
Fastest learning path to RoR
hi!
with a 4GL background, wanting to learn RoR, what is the fastest
learning path i should take? should i go grab a RoR tutorial, and learn
Ruby along the way, or start with plain Ruby first?
thanks for any inputs!
2011 Jun 28
2
OpenOffice 3.3.0 crashing on CentOS 5.5
The last few releases of OpenOffice have gotten very
unstable on my desktop which is a CentOS 5.5 i386 system.
After multiple crashes when doing embedded simple drawings
in OpenOffice writer (circles and lines with connections), I
started using the versions from Sun then Oracle. I am
now using version 3.3: openooffice.org3-3.3.0-9567. I've
lived with this but with version 3.x it has gotten
2011 Mar 29
0
Issue / code smell in AssociationProxy
I came across an issue in my code and after a hard debug session I
found something that smells.
First the context of my issue. I have a AR object that has a
polymorphic belongs_to currently tied to nothing, I want to dump it to
YAML.
record.to_yaml
This raises the following exception:
TypeError: wrong argument type nil (expected Data)
from
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this
2011 Oct 05
3
Firefox 7 on CentOS 5
Anyone have any luck running updated Firefox
on CentOS 5? We have CentOS 5 workstations
and need to update their Firefox but it dumps
core even when using the libstdc++ from Fedora 9.
I would like anything stable and secure beyond
Firefox 3 but can't find tarballs for anything
other than 7.0.1.
CentOS 5.5 i386 w/ updates
firefox-7.0.1.tar.bz2
libstdc++-4.3.0-8.i386.rpm from Fedora 9