routes:
map.listmovie ‘movies/listmovie/:id’, :controller => ‘movies’, :action
=> ‘listmovie’, :id => /\d+/
view:
<%= link_to ‘» »’, listmovie_path(m.letter) %>
controller:
def listmovie
@movies = Movie.find_by_first_letter(params[:id])
model:
def self.find_by_first_letter(letter)
find(:all, :conditions => ['ucase(left(name, 1)) = ? ', letter])
end
link:
http://localhost:3001/movies/listmovie/a
bekomme immer:
No route matches “/listmovie/a” with {:method=>:get}
Muß ich die route irgendwie anders schreiben oder was ist da faul?
Movie.find(.all) klappt…
Danke für Hinweise.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
schau dir sonst das hier noch an:
http://media.railscasts.com/videos/121_non_active_record_model.mov
Am 01.10.2008 um 21:13 schrieb Werner L.:
bekomme immer:
No route matches “/listmovie/a” with {:method=>:get}
Muß ich die route irgendwie anders schreiben oder was ist da faul?
Movie.find(.all) klappt…
Danke für Hinweise.
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
iD8DBQFI48/8s/WwCK0ZZEARAv08AKCmIM1urDSZf06zS58JKMf/qfeaUACghhjv
Rv3SosQg02ds0YfSEdEiQqc=
=Fimw
-----END PGP SIGNATURE-----
Am 01.10.2008 um 21:44 schrieb Michael Hanisch:
Danke… das wars war ich suchte…
Gruß
Hi Werner,
also das hier
:id => /\d+/
sagt, dass du nur “digits” erwartest, keine Buchstaben.
Also einfach den Regexp ändern…
Grüße, Michael.
On 01.10.2008, at 21:13, Werner L. wrote:
routes:
map.listmovie ‘movies/listmovie/:id’, :controller =>
‘movies’, :action => ‘listmovie’, :id => /\d+/