I''ve been working on my submissions tracker (for manuscripts), and I''m pretty darn new to the rails stuff. The way I got it working so far is as follows: So far, when getting submissions to look up manuscripts and markets, it''s working fine. However, now that I want to highlight a table row based on a manuscript''s genre, now I''m getting errors I don''t understand. From submissions/list.rhtml : <% @submissions.each do |@submission| %> <tr><td><%= link_to ''edit'', { :action => ''edit'', :market_id => @submission.market_id, :manuscript_id => @submission.manuscript_id } %></td> <td bgcolor="#<%= @submission.manuscript.mssGenre.bgcolor %>"><%= @submission.manuscript.Name %></td> <td bgcolor><%= @submission.market.mkMarketName %></td> <td align="center"><%= @submission.dateSent %></td> </tr> <% end %> Which is populated from this model method: def self.find_mss_out find(:all, :conditions => ''responseDate is null'', :order => ''dateSent DESC'', :include => [:manuscript, :market, :editor_reply]) end The error I get is: undefined method `bgcolor'' for "Science Fiction":String Obviously, I need to include mss_genre somewhere (or somehow force it to be loaded). But where? Since there''s always going to be some coloring based on genre, it wouldn''t be a bad thing to always load mss_genre when the manuscript record was loaded. What I don''t know is what to do to fix my problem. class Submission < ActiveRecord::Base belongs_to :market, :order => "mkMarketName" belongs_to :manuscript, :order => "name" belongs_to :editor_reply ... end class Manuscript < ActiveRecord::Base has_and_belongs_to_many :markets, :join_table => ''submissions'' belongs_to :mss_genre end class MssGenre < ActiveRecord::Base set_table_name "MssGenres" has_many :manuscript end (and so on, but the other tables aren''t relevant to my question) -- _Deirdre http://deirdre.net "Ideally pacing should look like the stock market for the year 1999, up and up and up, but with lots of little dips downwards...." -- Wen Spencer
Deirdre Saoirse Moen
2005-Jun-19 04:03 UTC
Solved Re: Second and subsequent relationship joins
On Jun 16, 2005, at 5:40 PM, Deirdre Saoirse Moen wrote:> I''ve been working on my submissions tracker (for manuscripts), and I''m > pretty darn new to the rails stuff.My problem was trying to fight the anti-camelCapsing of rails. Note to self: don''t do that then. -- _Deirdre http://deirdre.net "Ideally pacing should look like the stock market for the year 1999, up and up and up, but with lots of little dips downwards...." -- Wen Spencer
Michael Koziarski
2005-Jun-19 04:24 UTC
Re: Solved Re: Second and subsequent relationship joins
On 6/19/05, Deirdre Saoirse Moen <deirdre-mzk6fgDMp2XR7s880joybQ@public.gmane.org> wrote:> On Jun 16, 2005, at 5:40 PM, Deirdre Saoirse Moen wrote: > > > I''ve been working on my submissions tracker (for manuscripts), and I''m > > pretty darn new to the rails stuff. > > My problem was trying to fight the anti-camelCapsing of rails. Note to > self: don''t do that then.Yeah, that took me a while to shake, ditto the table naming standards. But once you''ve adjusted you realise how petty you were being ;) -- Cheers Koz