For a reason I can't figure out, no matter what I try. I have a page that refreshes inside a div on that page, recursively forever. At this point I'm sure it's something super obvious since I have tried everything and nothing changes it.
Here is the code:
def create @post = Post.new(params[:post]) @post.user_id = session[:user].id @post.conversation_id = params[:conversation_id]
@conversation = Conversation.find(params[:conversation_id])
replies = @conversation.replies + 1
@posts = Post.find(:all, :conditions => ["conversation_id = ?", params[:conversation_id]])
if @post.save Conversation.update(params[:conversation_id], { :updated_at => Time.now, :replies => replies }) User.update(session[:user].id, { :num_posts => (session[:user].num_posts += 1) }) redirect_to :controller => 'conversations', :action => 'show', :id => params[:conversation_id] else render :action => 'new' end end
That method is called by an ajax form. For some reason the redirect_to renders inside a div on the same page. It's rendering the whole page but no cleanly. I have no idea what it causing it.
Shouldn't redirect_to always render the entire page from scratch?