[typo] Redirects

Mike Purvis mike at uwmike.com
Wed Sep 7 15:54:12 EDT 2005


Interesting, thanks. However, I've got an error and a question.

Firstly, it's not finding "find_by_name". I noticed the the view_page 
action in the Article controller references "Page.find_by_name", but I 
don't see a separate Page controller... are pages just handled as Articles?

And the question: The article_url() function seems to be defined inside 
Application.rb file, which just calls url_for. Is url_for a general 
Rails url construction scheme that takes routing.rb rules into account, 
or is a part of Typo that's defined somewhere I'm not seeing?

Sorry to bombard with questions like this-- All the documentation online 
seems to be either "use scaffolding to accomplish X" or discussion 
that's way beyond me...

Mike
(if this should be taken off-list, just let me know...)


Scott Laird wrote:

> Title is in params[:title].  The tie between controllers and models  
> is generally explicit (except for scaffolding, but Typo doesn't use  
> it).  So you can do something like this:
>
>   def forward_old
>     article = Article.find_by_name(params[:title])
>     redirect_to article_url(article)
>   end



More information about the Typo-list mailing list