Yes got it working (I think). Thanks.
Got my slug working with some SHA1-fu. I did a to_param redefinition in my
Project controller:
def to_param
if state == 'active'
"#{self.slug}"
else
"#{self.id}-#{self.title.parameterize}"
end
end
So active Projects just get the slugged URL
Added: *get 'projects/:id_or_slug' => 'projects#show'* in my routes.rb. The
only part that has me concerned is my show override in
projects_controller.rb:
def show
@project = Project.find_by_id(params[:id_or_slug], :conditions => [
"state"" != ?", 'active' ])
if @project.nil?
@project = Project.find_by_slug(params[:id_or_slug])
if @project.nil?
redirect_to root_url
end
end
end
Which finds by Id as long as the project isn't in 'active' state. Fails
over to looking up by slug. Finally failing to a root_url redirect.
This “seems” to work but I am concerned that I am loosing some important
Hobo wizardry by redefining show like that.
Thanks again,
Nathan
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.