Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AlfaData < ActiveRecord::Base
- belongs_to :alfa
- def before(what)
- self.send( "#{what}_fรถre" )
- end
- end
- -----
- module ApplicationHelper
- def icontable( ds1, ds2, names )
- alfa = ""
- Mci.new.send( names ).each do |v|
- alfa += iconbox(v, ds1.send(v), ds2.send(v)) unless ['kampanj'].include?(v)
- end
- return alfa
- end
- end
- -----
- erb:
- icontable( ds1.method(:before), ds1.method(:after), 'pres' )
- ----
- Controller:
- ds1=Alfa.first.dataset
- ds2=Alfa.last.dataset
- ---
- Previously this was in the model too:
- def after(&block)
- lambda { |what| self.send( "#{what}_efter" ) }
- end
- didn't work either
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement