[Rails] Re: Re: Do associations work both ways?

2010-12-13 Thread Marnen Laibow-Koser
Rob Biedenharn wrote in post #968091: On Dec 12, 2010, at 4:59 PM, Rodrigo Mendona wrote: other way is %=p.user.name unless p.user.empty?% Or, you can push that into the model and avoid the extra logic in the view: class Post def user_name self.user ? self.user.name : (none)

Re: [Rails] Re: Re: Do associations work both ways?

2010-12-13 Thread Rob Biedenharn
On Dec 13, 2010, at 2:40 PM, Marnen Laibow-Koser wrote: Rob Biedenharn wrote in post #968091: On Dec 12, 2010, at 4:59 PM, Rodrigo Mendona wrote: other way is %=p.user.name unless p.user.empty?% Or, you can push that into the model and avoid the extra logic in the view: class Post def

Re: [Rails] Re: Re: Do associations work both ways?

2010-12-13 Thread Colin Law
On 13 December 2010 19:40, Marnen Laibow-Koser li...@ruby-forum.com wrote: Rob Biedenharn wrote in post #968091: On Dec 12, 2010, at 4:59 PM, Rodrigo Mendona wrote: other way is %=p.user.name unless p.user.empty?% Or, you can push that into the model and avoid the extra logic in the view: