Mohit S. wrote:
to resolve it. For this, I changed the following line in the
comments_controller.rb > create:
This way, it should just redirect to the page on which the comment was
posted. It seems to work… but can someone confirm if that is indeed
the correct way to deal with it?
I have been further playing and have spent quite a while copying back
code from Radiant’s controllers into the Comments Controller to see what
works. This is what the create function looks like now and it seems
like it works. Could someone help me see if my assumption is correct?
Is this how we should modify the create action on the comments
controller to fix it in case validation fails? It appears that relative
URLs are also rendering correctly now.
comment = @page.comments.build(params[:comment])
comment.request = request
if Radiant::Config['comments.notification'] == "true"
if comment.approved? ||
Radiant::Config[‘comments.notify_unapproved’] == “true”
flash[:selected_comment] = comment.id
#Changed the line below to deal with wrong rendering of relative
links even when validation passes
@pg = Page.find_by_url(@page.url)
@pg.last_comment = comment
#process_page(@page) <-- replaced this with the part below since
process_page is private in SiteController
@cache.cache_response(url, response) if request.get? and live?
@performed_render = true
render :template => ‘site/not_found’, :status => 404
Any help would be greatly appreciated!
5/10/2009 | 1:10 AM.