# SystemExit: exit

**URL:** <https://www.ruby-forum.com/t/systemexit-exit/192629>\
**Category:** Rails\
**Created:** [August 3, 2010, 12:03pm UTC](https://www.ruby-forum.com/t/systemexit-exit/192629 "2010-08-03T12:03:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [August 3, 2010, 12:03pm UTC](https://www.ruby-forum.com/t/systemexit-exit/192629/1 "2010-08-03T12:03:29Z")

</div>

ActionView::TemplateError (SystemExit: exit: SELECT \* FROM  
product\_stocklevels WHERE (product\_stocklevels.product\_id = 831 AND  
(size = ‘W44 L 32’ AND stock \> 0)) LIMIT 1)

Before I paste more code, has anyone come across this before?

---

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [August 3, 2010, 9:32pm UTC](https://www.ruby-forum.com/t/systemexit-exit/192629/2 "2010-08-03T21:32:08Z")

</div>

Pale H. wrote:

> ActionView::TemplateError (SystemExit: exit: SELECT \* FROM  
> product\_stocklevels WHERE (product\_stocklevels.product\_id = 831 AND  
> (size = ‘W44 L 32’ AND stock \> 0)) LIMIT 1)
> 
> Before I paste more code, has anyone come across this before?

Maybe you need to paste more code. Only think we can tell from this is  
that you have a TemplateError in your view. Most likely a syntax error  
somewhere.

---

<div class="post-metadata">

**Author:** ![mercurius](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c89c15/32.png) [@mercurius](https://www.ruby-forum.com/u/mercurius)\
**Post date:** [August 4, 2010, 10:46am UTC](https://www.ruby-forum.com/t/systemexit-exit/192629/3 "2010-08-04T10:46:20Z")

</div>

Robert W. wrote:

> Pale H. wrote:
> 
> > ActionView::TemplateError (SystemExit: exit: SELECT \* FROM  
> > product\_stocklevels WHERE (product\_stocklevels.product\_id = 831 AND  
> > (size = ‘W44 L 32’ AND stock \> 0)) LIMIT 1)
> > 
> > Before I paste more code, has anyone come across this before?
> 
> Maybe you need to paste more code. Only think we can tell from this is  
> that you have a TemplateError in your view. Most likely a syntax error  
> somewhere.

The trace shows the following erroneous methods:

* * *

def for\_size(size, pid)  
ret = find(:first, :conditions =\> [“size = ? AND stock \> 0”, size])  
ret = ProductStocklevel.create(:product\_id =\> pid, :size =\> size,  
:stock =\> 0)  
unless ret  
ret  
end  
end

def stock\_id(size)  
self.product\_stocklevels.for\_size(size, self.id).id.to\_s  
end

* * *

Both are in the Product model. It’s only this particular product, 831,  
that is causing this error.
