salve a tutta la lista =)
premessa:
sto lavorando su un controller (pages) che gestisce una semplice pagina
(titolo, corpo, etc...), vorrei stabilire come/dove visualizzarle in
fruizione.
ho pensato che usando un valore *ordering* nelle pagine, potrei
richiamarle successivamente seguendo il loro ordering. ad esempio la
"home" avrebbe ordering=1, "about" avrebbe 2, etc...
problema:
ho letto da molte parti che il plugin acts_as_list serve a gestire liste
ordinate. guardando però gli esempi, sembra che dovrei avere 2 modelli:
1 contenitore ed 1 contenuto. un esempio potrebbe essere:
class Page < ActiveRecord::Base
has_permalink :title, :unless => lambda { |page| page.title.blank? }
belongs_to :page_list
acts_as_list :scope => :page_list
[...]
end
class PageList < ActiveRecord::Base
has_many :pages, :order => "ordering"
end
il problema è che non vorrei usare un modello *contenitore* per le
pagine, ma allo stesso tempo mi piacerebbe gestire l'ordering in modo
semplice.
avete qualche consiglio a riguardo? sapete se è possibile sfruttare
acts_as_list usando solo 1 modello?
grazie in anticipo =)
A.
on 2009-06-04 13:37
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.