Displaying 20 results from an estimated 600 matches similar to: "polymorphic association"
2011 May 20
3
How to handle non model data in form?
Hey,
I got a form which looks like this:
- form_for(@article, :html => {:multipart => true}, :url =>
articles_path) do |f|
= errors_for(@article)
.field
= f.label :text
%br
= f.text_field :text
.field
= f.label :author_id
%br
= f.text_field :author_id
.actions
= f.submit
But since I don''t want anyone to type in an author id I changed it
2005 Apr 20
4
Error in tutorial or sintax changed?
Hi,
In this tutorial
http://wiki.rubyonrails.com/rails/show/HowtoUseJoinsWithFindAll
it sad:
sql =<<SQL
SELECT articles.*, authors.name AS author_name
FROM articles
LEFT JOIN authors ON author_id = authors.id
SQL
and this return
*app/controllers/media_controller.rb:366: can''t find string "SQL"
anywhere before EOF*
what is wrong? the tutorial or ruby changed?
please,
2006 Sep 03
7
using polymorphic associations with acts_as_list
This is what I have
class Photo < ActiveRecord::Base
belongs_to :image, :polymorphic => true
acts_as_list :scope => image
end
class Place < ActiveRecord::Base
has_many :photos, :as => :image
end
class Child < ActiveRecord::Base
has_many :photos, :as => :image
end
I want to be able to reorder the images. What I need is for the
position of the photos to be set
2006 Jun 11
3
[SUMMARY] Rails Core Weekly June 5 - June 11
Dear list,
This weeks RCW has a slightly different format than before. After all,
since what we want is less bloat, this RCW is less verbose. Please do
let me know what you think off-list.
*Interesting stuff on the Rails Timeline*
_Fixed and commited to trunk:_
An issue with not null columns in SQLite3 migrations(<a
2010 Nov 26
2
cucumber
Hello How do i test the tiny_mce using cucumber + capybara.
Thanks for any help.
abhis
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2006 Jul 18
2
A quick question on forms
I want to change parts of this form in order to use default values (with a
disabled input). The problem is if I change it from text_field to
text_field_tag that part of the form stops functioning. It seems like a
silly question, but its been driving me crazy. Any help would help.
Steve.
<%= error_messages_for ''post'' %>
<!--[form:post]-->
<p><label
2006 Jul 22
0
RSS XML Generation Problem
I''m getting an interesting problem. I''d trying to generate an RSS document
and then real it from outside of my app. Here''s what the view looks like.
xml.instruct! :xml, :version=>"1.0"
xml.rss(:version=>"2.0"){
xml.channel{
xml.title("mytitle")
xml.link("http://www.myapp.com")
2011 Oct 25
1
Customizing errors
Hello fellow Rails devs,
I had a slight problem with validation messages. I had a Post AR model
that has an :author_name attribute.
Now if a validation goes wrong, I would like the message to say: "Name
of author can''t be blank" as opposed to "author name can''t be blank".
I have tried looking into the Rails Guides for I18n #5 but it seems
2007 Apr 21
0
has_many / has_one polymorphic with conditions
I''m looking for a way to make this work (I think the code is more
explanatory at this point):
## THIS WORKS
has_many :images, :as => :imageable, :dependent => :destroy, :order =>
''position ASC''
# @product.images => #
## THIS DOESNT
has_one :featured_image, :as => :imageable, :conditions => "position =
1"
# @product.featured_image =>
2006 Jul 31
0
Polymorphic has_many association through a belongs_to
Hi,
Let''s say I''ve the following Models and their relative associations:
Seat
----
belongs_to :booking
Booking
-------
has_many :seats
has_many :debits, :as => :chargeable
Debits
------
belongs_to :chargeable, :polymorphic => true
Why
>> seat.booking.debits
nil
while
>> Booking.find(seat.booking_id).debits
[]
?
Thanks.
Cheers,
Marco
2006 May 05
2
Dumb polymorphic association question
Hi,
Why is it that polymorphic associations only work with the :has_many
and :belongs_to relationships? Why can''t it be a :has_one?
Matt
2006 Apr 17
0
polymorphic association with single model as target
Hi,
I''m new to rails/ruby and not a sw programmer in the first place.
I''d like to use polymorphic associations to create tags/marks into
several dictionary tables (i.e japanese to english and japanese to
french) that share the same model. In that model I introduced a :target
field to select the database in a find query, i.e:
def self.find(*args)
for i in args
if
2006 Mar 26
0
Eager loading and polymorphic association
Hi all,
Is it possible to do "eager loading" with polymorphic associations ?
Ex : I have a Page model that acts as taggable. When I do
Page.find(:all), I would like to retrieve all tags associated with a
page.
Thanks,
Thomas.
--
Posted via http://www.ruby-forum.com/.
2010 May 07
1
Can't eagerly load a polymorphic association defined in an STI parent class?
If I define an association (in my case a polymorphic one) in an STI
parent class, and try to eagerly load it in a subclass, I get the
following error:
ActiveRecord::ConfigurationError: Association name ''myassoc'' was not
found; perhaps you misspelled it?
If I redefine the same association again in the STI subclass, it
works.
Is this a bug or what?
--
You received this message
2008 Jun 24
1
Get model from polymorphic association
Hi,
If using a polymorphic belongs_to, is it possible to access the "_type"
field that contains the name of the model ?
Thanks!
--
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 post to this group, send email to
2011 Jul 08
0
Looking for Help/Advice on StackOverflow Question - Polymorphic Association with STI
I am having trouble with an many to many polymorphic association with
STI involved. The problem is described clearly in the following
StackOverflow question, so I will leave this thread short:
http://stackoverflow.com/questions/6582074/activerecord-has-many-through-polymorphic-associations-with-sti
I am posting here hoping to get advice/direction/a solution for this,
as I''ve so far been
2011 Jan 11
0
[PATCH] Polymorphic belongs_to association with :conditions issues
Hey all,
Could use a few eyes on a couple of very simple patches at https://rails.lighthouseapp.com/projects/8994/tickets/6262 if any has some time.
The issue (from the ticket description):
If you define a polymorphic belongs_to association and it has conditions on it, those conditions cause a NameError when you try to access the target object, of the style saying "hey, there''s no
2007 Mar 19
0
PGError "unknown column" on polymorphic association column
Hi all !
This is very strange. I am attempting to get my application running
on PostgreSQL (from MySQL), and I get this error:
ActiveRecord::StatementInvalid: PGError: ERREUR: la colonne «Party»
n'existe pas
: SELECT * FROM contact_routes WHERE (routable_type = "Party" AND
routable_id = 1000013) ORDER BY position DESC LIMIT 1
2010 Mar 29
0
Polymorphic association and has_one retrieval issues
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
class Client < ActiveRecord::Base
has_one :address, :as => :addressable
end
Now I''am able to create a correct entry in the db for address with
addressable_id = 1#client_id
addreassable_type = ''Client''
but when I retrieve
client = Client.find(1) --> return client
2010 Apr 10
1
accepts_nested_attributes + polymorphic association
im having an issue where my my polymorphic associations arent being
deleted when using accepts nested attributes
there are other accepts_nested_attributes being used and they are
deleting fine, just the polymorphic association
before i go down the path of intense thrashing at this...is this a known
issue or problem?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because