Hallo zusammen, ich misch mich mal ein...

Was gemeint ist:

class ModelName
  def self.load_stuff_with_sql
    self.find_by_sql(...)
  end
end

Und in den ApplicationController (before-filter wurde ja schon richtig
gesagt) kommt dann der Aufruf rein:

class ApplicationController
  before_filter :load_stuff

  def load_stuff
    @variable = ModelName.load_stuff_with_sql
  end
end

Lässt sich deutlich besser testen und entspricht dem MVC-Pattern.

Viele Grüße
Nicolai
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an