Displaying 2 results from an estimated 2 matches for "find_post".
Did you mean:
find_host
2006 Aug 16
5
Rails theory question, where to put a join query
...ined queries..
Perhaps some experienced insight will straighten this out for me.
Say you have two tables with two models, ''authors'' and ''posts''.
an author has_many posts, a post has_one author.
You need methods to do the following queries:
find_author(postid)
find_posts(authorid)
And you are doing a custom join query for both. How do you decide what
model they go into? To me either can make sense, so I am uncomfortable with
picking one.
Could I get some comments? Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://w...
2007 Jul 31
0
Edit not working with named routes
...an existing post. For some reason it just doesn''t want to do
anything. Below are the relevant (I think) parts of the
PostsController:
class PostsController < ApplicationController
layout "blog"
before_filter :login_required, :except => [:index, :show]
before_filter :find_post, :except => [:index, :new, :create]
def edit
end
def update
if @post.update_attributes(params[:post])
flash[:notice] = "Post Updated"
redirect_to post_url(@post)
else
render edit_post_url
end
end
protected
def find_post
@post = Post.fin...