From: Peter Ehrlich Date: 2009-08-20T00:57:48+09:00 Subject: Re: exercise in DRY Alright, thanks to both of you, its working beautifully (and I've learned a couple new things..) A mistake in my css has made me think that class names were not working ajax - but thats remedied now. Cheers, --Peter Fabian Streitel wrote: > that's not quite correct > > How about: (assumes rails and haml) > > >> before_filter :find_tweet, :only => [:agree, :disagree_count] > > > (nice one, I totally forgot the filters... ) > >> def disagree >> @tweet.disagree_count += 1 >> render :partial => 'consensus_agree' > > > this has to be > render :partial => 'consensus_disagree' > of course > > end >> >> --------- _consensus_agree.haml --------------- >> >> %span{:style => 'color: green'}= @tweet.agree_count - 1 >> %span{:style => 'color: red'}= @tweet.disagree_count >> >> ----------------------------------------------- > > > so you'd have to have a second haml file for disagree. > Greetz -- Posted via http://www.ruby-forum.com/.