Displaying 3 results from an estimated 3 matches for "find_by_slug".
Did you mean:
find_by_sig
2006 Jan 11
0
Issues with dynamic finders ruby-1.8.4 / rails-1.0.0
Hi all,
I am not certain this is a 1.8.4 related issue, but I think it might be.
I''m trying to use dynamic finders for my Category and Post models,
such that a request /blog/categories/general would detect the slug and
do a find_by_slug() instead of find(params[:id]).
My have_slug?() method works fine, and the dynamic finders *were*
working fine until I moved it off my local machine running 1.8.2 (win)
onto a live server running 1.8.4 (redhat enterprise 3).
Now, vanilla finds work just fine, but the table names are not getting
p...
2006 Mar 22
2
Controller instance variables falling in and out of scope
Very bizarre behavior has cropped up in a few spots.
# the action for viewing a blog post
def posts
@post = BlogPost.find_by_slug(params[:id], :include => :commentary)
# a breakpoint here shows @post and @post.commentary with appropriate data
redirect_to :action => ''archive'' unless @post
end
# posts.rhtml
<%= @post.inspect %> => nil
<%= render :partial => ''post'', :...
2005 Mar 05
3
routes inconsistency?
...o my table, "slug", which is a short, unique
keyword to identify each page. Then I added this field to my edit
template and adjusted the model to properly validate it''s uniqueness &
length. Afterwards, I added this method to my controller:
def show_by_slug
@page = Page.find_by_slug(@params[''slug''].sub(/.shtml$/, ""))
render_action ''show''
end
And finally, I added this to my routes:
map.connect '':slug'', :controller => ''pages'', :action => ''show_by_slug''
Now, with al...