Hallo Werner,

entweder du machst es so:

if irgendwas
        Model1.find_by_plz(params[:plzcheck][:plz]
else
        Model2.find_by_plz(params[:plzcheck][:plz]
end

oder wenn du mehr als nur zwei Möglichkeiten haben willst und viele if abfragen vermeiden willst, kannst du es auch so machen:

 "Module".constantize.find_by_plz(params[:plzcheck][:plz]

und "Module" is dann halt der name des Modules...

gruß
Manuel

Am 20.12.2008 um 18:00 schrieb Werner Laude:

Hallo.
ich mochte gerne bei

Model.find_by_plz(params[:plzcheck][:plz])

das Model austauschbar, abhängig von einer Bedingung machen..
Also je nachdem wer sich einlogged, bekommt eine andere Tabelle.

Einfach eine String für Model reinsetzen klappt irgendwie nicht..
Wie könnte das aussehen?

Gruß


Werner Laude
Lindenburger Allee 22  -  50931 Köln

0221.8805 635

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

http://www.webagentur-laude.de

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an