That was fun. Due to some mix-up, I ended up having to rename my models. At any event, I managed to fix everything, except that I kept getting this message when I attempted to delete an entry: ActiveRecord::StatementInvalid (Mysql::Error: Table ''development.platforms_weburls'' doesn''t exist: SHOW FIELDS FROM `platforms_weburls`): The way I setup my module is that platforms and weburls are connect via the has_and_belongs_to_many association. So I was expecting for the rails up to look it up like: weburls_platforms. But no. :( This is the second time that happened to me and in both instances, I ended up having to rename the tables to get the models working (of note is that I had to redo the models in the first open as well - also a hbtm relation - same base table). Am I missing someplace as to how rails put together the join table names? And is there a better way of addressing it? My current tables don''t look very consistent. >:( - Rilindo -- 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 rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Dec 7, 2009 at 4:35 PM, Rilindo Foster <rilindo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That was fun. > > Due to some mix-up, I ended up having to rename my models. At any event, I > managed to fix everything, except that I kept getting this message when I > attempted to delete an entry: > > > ActiveRecord::StatementInvalid (Mysql::Error: Table > ''development.platforms_weburls'' doesn''t exist: SHOW FIELDS FROM > `platforms_weburls`): > > The way I setup my module is that platforms and weburls are connect via the > has_and_belongs_to_many association. So I was expecting for the rails up to > look it up like: > > weburls_platforms. > > But no. :( > > This is the second time that happened to me and in both instances, I ended > up having to rename the tables to get the models working (of note is that I > had to redo the models in the first open as well - also a hbtm relation - > same base table). Am I missing someplace as to how rails put together the > join table names? And is there a better way of addressing it? My current > tables don''t look very consistent. >:( > > - Rilindo > > -- > >Do you have a database table called ''platforms_weburls'' with ''platform_id'' and ''weburl_id'' fields? -Conrad> 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 > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > >-- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No, just:> weburls_platforms with ''platform_id'' and ''weburl_id'' fieldsOn Dec 7, 2009, at 9:41 PM, Conrad Taylor wrote:> On Mon, Dec 7, 2009 at 4:35 PM, Rilindo Foster <rilindo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > That was fun. > > Due to some mix-up, I ended up having to rename my models. At any event, I managed to fix everything, except that I kept getting this message when I attempted to delete an entry: > > > ActiveRecord::StatementInvalid (Mysql::Error: Table ''development.platforms_weburls'' doesn''t exist: SHOW FIELDS FROM `platforms_weburls`): > > The way I setup my module is that platforms and weburls are connect via the has_and_belongs_to_many association. So I was expecting for the rails up to look it up like: > > weburls_platforms. > > But no. :( > > This is the second time that happened to me and in both instances, I ended up having to rename the tables to get the models working (of note is that I had to redo the models in the first open as well - also a hbtm relation - same base table). Am I missing someplace as to how rails put together the join table names? And is there a better way of addressing it? My current tables don''t look very consistent. >:( > > - Rilindo > > -- > > > Do you have a database table called ''platforms_weburls'' with ''platform_id'' and ''weburl_id'' fields? > > -Conrad > > 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 rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > > -- > > 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 rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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 rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 8, 12:35 am, Rilindo Foster <rili...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > The way I setup my module is that platforms and weburls are connect via the has_and_belongs_to_many association. So I was expecting for the rails up to look it up like: > > weburls_platforms. > > But no. :( >with habtm the order is alphabetical, so platforms_weburls. Fred -- 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 rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Check the documentation here: http://wiki.rubyonrails.org/howtos/db-relationships/basic Scroll down to the habtm section and see: "Ruby will assume the name of the join table to be the concatenation of the two tables'' names in alphabetical order. In our example, the join table would be assumed as courses_students. " In your case Rails habtm expects platform_weburls because p is before w. On Dec 7, 10:13 pm, Rilindo Foster <rili...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> No, just: > > > weburls_platforms with ''platform_id'' and ''weburl_id'' fields > > On Dec 7, 2009, at 9:41 PM, Conrad Taylor wrote: > > > On Mon, Dec 7, 2009 at 4:35 PM, Rilindo Foster <rili...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > That was fun. > > > Due to some mix-up, I ended up having to rename my models. At any event, I managed to fix everything, except that I kept getting this message when I attempted to delete an entry: > > > ActiveRecord::StatementInvalid (Mysql::Error: Table ''development.platforms_weburls'' doesn''t exist: SHOW FIELDS FROM `platforms_weburls`): > > > The way I setup my module is that platforms and weburls are connect via the has_and_belongs_to_many association. So I was expecting for the rails up to look it up like: > > > weburls_platforms. > > > But no. :( > > > This is the second time that happened to me and in both instances, I ended up having to rename the tables to get the models working (of note is that I had to redo the models in the first open as well - also a hbtm relation - same base table). Am I missing someplace as to how rails put together the join table names? And is there a better way of addressing it? My current tables don''t look very consistent. >:( > > > - Rilindo > > > -- > > > Do you have a database table called ''platforms_weburls'' with ''platform_id'' and ''weburl_id'' fields? > > > -Conrad > > > 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > > -- > > > 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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 rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks! I''ll have to keep that in mind in future when I create my models. Chalking this up as a newbie mistake. . . On Dec 8, 2009, at 4:04 AM, Frederick Cheung wrote:> > > On Dec 8, 12:35 am, Rilindo Foster <rili...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> The way I setup my module is that platforms and weburls are connect via the has_and_belongs_to_many association. So I was expecting for the rails up to look it up like: >> >> weburls_platforms. >> >> But no. :( >> > with habtm the order is alphabetical, so platforms_weburls. > > Fred > > -- > > 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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 rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.