# Activerecord validation error after a redirect\_to

**URL:** <https://www.ruby-forum.com/t/activerecord-validation-error-after-a-redirect-to/137672>\
**Category:** Rails\
**Created:** [May 15, 2008, 7:17am UTC](https://www.ruby-forum.com/t/activerecord-validation-error-after-a-redirect-to/137672 "2008-05-15T07:17:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 15, 2008, 7:17am UTC](https://www.ruby-forum.com/t/activerecord-validation-error-after-a-redirect-to/137672/1 "2008-05-15T07:17:39Z")

</div>

Hi  
I have a respond\_to block as below  
respond\_to do |format|  
if @service\_desk\_resolution.save  
format.js{render :action =\> “sd\_resolution\_save.rjs”}  
format.html {redirect\_to(:action =\> ‘show\_details’, :id =\>  
params[:id],:activeTab =\> 1) }  
else  
format.js { render :action =\> ‘sd\_resolution\_save\_errors.rjs’ }  
format.html {redirect\_to :action =\> ‘define\_sd\_resolution\_ui’,:id =\>  
params[:id],:sd\_resolution\_id=\>params[:sd\_resolution\_id],:page=\>‘search\_sd\_ticket’}  
end

and

def define\_sd\_resolution\_ui  
@sd\_ticket\_id=params[:id]  
@sd\_resolution\_id=params[:sd\_resolution]  
@sd\_ticket=ServiceDeskTicket.find(params[:id])  
@sd\_resolution=@sd\_ticket.service\_desk\_resolution  
#The following line is used to make sure days,hours,minutes get  
default value zero  
@sd\_resol = ServiceDeskResolutionEffort.new()  
@sd\_resol.showdata(“00:00”)  
if(!@sd\_resolution.nil?)  
if(!@sd\_resolution.effort.nil?)  
@sd\_resol = ServiceDeskResolutionEffort.new()  
@sd\_resol.showdata(@sd\_resolution.effort)  
end  
end  
end

My problem is in the above else case after redirect to  
define\_sd\_resolution\_ui my active record validation does not show the  
error message as expected.which i gave in define\_sd\_resolution\_ui.rhtml  
as \<%= error\_messages\_for ‘service\_desk\_resolution’ %\> Why this happens?

Sijo

---

<div class="post-metadata">

**Author:** ![sijo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/da6949/32.png) [@sijo](https://www.ruby-forum.com/u/sijo)\
**Post date:** [May 15, 2008, 9:15am UTC](https://www.ruby-forum.com/t/activerecord-validation-error-after-a-redirect-to/137672/2 "2008-05-15T09:15:01Z")

</div>

I solved it
