Displaying 2 results from an estimated 2 matches for "comments_url".
Did you mean:
comment_url
2006 Aug 05
0
Another generic CRUD controller
...39;'
end
def show
end
def edit
end
def update
@comment.attributes = params[:comment]
@comment.save!
redirect_to comment_url
rescue ActiveRecord::RecordInvalid
render :action => ''edit''
end
def destroy
@comment.destroy
redirect_to comments_url
end
protected
def find_comment
set_scope { @comment = Comment.find(params[:id]) }
end
def set_scope
scope = { :post_id => params[:post_id] }
Comment.with_scope( :find => { :conditions => scope }, :create =>
scope ) { yield }
end
end
--
Posted v...
2006 Aug 03
6
Listing all of a nested Resources
I''ll use the example on the Rails blog.
map.resources :posts do |posts|
posts.resources :comments, :trackbacks
end
Now comments are at /posts/:post_id/comments.
Okay but what if I want to list all the comments for all the posts. It
should be at /comments, but that isn''t map that way. Can I map comments
twice?
--
Posted via http://www.ruby-forum.com/.