Ruby on Rails Wednesday, June 30, 2010

On Wed, Jun 30, 2010 at 10:12 AM, Joe <joe@dev-hq.co.uk> wrote:
> So, I can't just pass it my permalink value (which is worked out using
> to_param)? I have to create a whole method using regex that returns
> something that is exactly the same?

Why am I starting to feel I'm talking to the wall? :-)

You have URLs, .e.g.

/tutorials/1
/tutorials/3
/tutorials/12

You need a method to extract the unique ID from each of those and
return the permalink value. You don't *have* to use a regex, it's just
a common approach. Write it any way you want. But that is the first
step to solving your problem. Unless you just manually create every
rewrite rule, of course.

> I would GREATLY appreciate it if you could just give a reply like "If
> I had a blog with the same kind of setup, what I could do is write a
> redirect like this, as you can get the permalink value by doing this."

That *would* be an awesome trick, considering that I don't have any
idea where *your* permalink values are coming from. You could be
storing them in the DB, generating them on the fly, scooping them out
of Schrödinger's cat's litter box -- who knows?

Wait -- *you* know, so *you* can write that code.

Though as Marnen previously suggested, many of us *are* available
for contract work :-)

Good luck,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment