Colin Law wrote: > 2009/9/28 Cs Webgrl <[email protected]>: >> still get an error. > You have snipped the original. > I don't know whether has_permalink is happy with nil parameters, if so > then you could just do > > def neighborhood_name > neighborhood.name if neighborhood > end > > This will return nil if neighborhood is nil. > If you need a default name however then something like > > def neighborhood_name > neighborhood ? neighborhood.name : 'default_name' > end
Yeah, that's about what I was thinking. > > If Marnen reads this he will tell you (and probably me) in no > uncertain terms to read up on basic Ruby coding :) Good God, am I becoming a List Personality [TM]? :) You're right, I'd recommend that the OP brush up on basic Ruby. For you, I'd simply recommend not spoon-feeding... > > Colin Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

