- Duane Johnson :> On Jul 1, 2005, at 3:22 AM, Nicholas Wieland wrote:
> >I''m working on a tiny wiki engine to use in my own projects,
and I''m
> >having some troubles on what approach is more "railish" when
rendering
> >pages.
> >For example, I create new pages with CamelCase notation or inside
> >brackets, so every time I view a page I obviously want to gsub
> >[NewPage]
> >with a link (to an existing page or to app/NewPage/new).
> >My first thought was to write all the substitution stuff inside a
> >model,
> >but now I''m not sure, I can write everything as a
before_filter,
> >even as
> >a helper, and sleep well at night.
>
> I''m trying to imagine how you''d use a before_filter to do
the
> replacing? Would it be a filter that modifies the contents of
> @params? If that''s the case, it might be better to use a
protected
> method in your controller (maybe even the application controller if
> it''s used all across the application).
>
> Maybe you can explain your thoughts on each possibility?
Well, it''s more like brainstorming than concrete ideas.
It seems quite natural to me to write something that must filter some
kind of text as a filter, maybe because filters have some cute features
(like chaining) that seem perfect for what I''m trying to accomplish.
Actually I can''t think of an implementation, when I view a page I have
to fetch it from the DB, so I don''t think before_filter is a viable
solution.
I can use a method inside the controller, but thinking of how many
substitutions I can eventually do (for example fetching links, than
transforming the page using RedCloth and so on) I have the feeling that
it''s not the correct solution, the controller can become too big and
bloated (but maybe I''m plain wrong here.... )
What I think is confusing is that I don''t have the slightest idea of
where to put this code - I think that it belongs to the model because
I''m working on data, but as I said I''m not sure,
that''s because I was
asking the list for ideas.
Thanks for your time,
ngw
--
checking for life_signs in -lKenny... no
Oh my god, make (1) killed Kenny ! You, bastards !
nicholas_wieland-at-yahoo-dot-it
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it