So I have classes: [code] class Calendar < ActiveRecord::Base has_many :stamps class Stream < Calendar has_many :events, :through => :stamps class Audience < Calendar has_many :events, :through => :stamps class Stamp < ActiveRecord::Base belongs_to :user belongs_to :customevent belongs_to :event belongs_to :calendar class Event < ActiveRecord::Base belongs_to :user has_many :stamps, :dependent => :delete_all has_many :streams, :through => :stamps, :source => :calendar, :dependent => :destroy has_many :audiences, :through => :stamps, :source => :calendar, :dependent => :destroy [/code] Initially, Event and Audience were: [code] class Audience < Calendar has_and_belongs_to_many :events class Event < ActiveRecord::Base belongs_to :user has_many :stamps, :dependent => :delete_all has_many :streams, :through => :stamps, :source => :calendar, :dependent => :destroy has_many_and_belongs_to_many :audiences [/code] This was so that an Audience calendar would be completely different from a Stream calendar. Now I want them to be basically the same thing just with a different categorization, so I did the above changes. The problem is that now none of the events I make and put in an audience calendar get saved to the audience calendar. I think it''s an issue with there being too many connections (events - audiences - stamps - streams) or something like that. Can somebody please enlighten me about what''s happening and how i could possibly fix it? Thanks a lot! -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28 May 2008, at 20:11, Amanda .. wrote:> This was so that an Audience calendar would be completely different > from > a Stream calendar. Now I want them to be basically the same thing > just > with a different categorization, so I did the above changes. The > problem is that now none of the events I make and put in an audience > calendar get saved to the audience calendar. >What is it you''re doing that isn''t producing the expected result? Fred> I think it''s an issue with there being too many connections (events - > audiences - stamps - streams) or something like that. Can somebody > please enlighten me about what''s happening and how i could possibly > fix > it? > > Thanks a lot! > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 28 May 2008, at 20:11, Amanda .. wrote: >> This was so that an Audience calendar would be completely different >> from >> a Stream calendar. Now I want them to be basically the same thing >> just >> with a different categorization, so I did the above changes. The >> problem is that now none of the events I make and put in an audience >> calendar get saved to the audience calendar. >> > > What is it you''re doing that isn''t producing the expected result? > > FredMy site displays a list of all the calendars (audiences and streams) and each has a link that shows how many events are in the given calendar. This link should go to a page that lists all the events in the calendar. Before changing the code, the audience calendars'' links displayed the correct numbers and the events appeared as they should when I clicked the link. Now for all the audiences, the link shows that there are 0 events in it. I think this could be because I''m no longer using the "audiences_events" table I was using with has_and_belongs_to_many and the events that were stored in there before aren''t getting switched over to wherever they should be? lol I don''t really know what''s going on in the database with these changes, I''ve only been using Ruby on Rails for a couple weeks now. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Should I be using has_many_polymorphs instead? There seems to be an extra connection I''m trying to make than on any other many-to-many example I''ve looked up. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28 May 2008, at 21:11, Amanda .. wrote:> > Frederick Cheung wrote: >> On 28 May 2008, at 20:11, Amanda .. wrote: >>> This was so that an Audience calendar would be completely different >>> from >>> a Stream calendar. Now I want them to be basically the same thing >>> just >>> with a different categorization, so I did the above changes. The >>> problem is that now none of the events I make and put in an audience >>> calendar get saved to the audience calendar. >>> >> >> What is it you''re doing that isn''t producing the expected result? >> >> Fred > > My site displays a list of all the calendars (audiences and streams) > and > each has a link that shows how many events are in the given calendar. > This link should go to a page that lists all the events in the > calendar. > Before changing the code, the audience calendars'' links displayed the > correct numbers and the events appeared as they should when I clicked > the link. Now for all the audiences, the link shows that there are 0 > events in it. I think this could be because I''m no longer using the > "audiences_events" table I was using with has_and_belongs_to_many and > the events that were stored in there before aren''t getting switched > over > to wherever they should be? lol I don''t really know what''s going on in > the database with these changes, I''ve only been using Ruby on Rails > for > a couple weeks now.Well the contents of audiences_events is certainly not going to get magically get migrated for you. Fred> > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Well the contents of audiences_events is certainly not going to get > magically get migrated for you. > > FredThats the problem...I don''t know how to do that -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 29 May 2008, at 13:42, Amanda .. wrote:> > >> >> Well the contents of audiences_events is certainly not going to get >> magically get migrated for you. >> >> Fred > > Thats the problem...I don''t know how to do thatevery row in the audiences_events table will become a row in the stamps table by the looks of it. Fred> > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 29 May 2008, at 13:42, Amanda .. wrote: > >> > > every row in the audiences_events table will become a row in the > stamps table by the looks of it. > > FredWould I have to do that manually? If so, it wouldn''t be hard to do in the test database...but when we go to the production database there are a ton of rows in audiences_events that would have to be switched over -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 29 May 2008, at 14:54, Amanda .. wrote:> > Frederick Cheung wrote: >> On 29 May 2008, at 13:42, Amanda .. wrote: >> >>> >> >> every row in the audiences_events table will become a row in the >> stamps table by the looks of it. >> >> Fred > > Would I have to do that manually? If so, it wouldn''t be hard to do in > the test database...but when we go to the production database there > are > a ton of rows in audiences_events that would have to be switched overI suggest you write a script that does that (and test it on a copy of the production database first!) Fred> > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---