# Post.where() causing 500 error

**URL:** <https://meta.discourse.org/t/post-where-causing-500-error/40896>\
**Category:** Development\
**Created:** [Março 11, 2016, 10:33am UTC](https://meta.discourse.org/t/post-where-causing-500-error/40896 "2016-03-11T10:33:23Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Andrew\_Byrne](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_byrne/32/116413_2.png) [@Andrew\_Byrne](https://meta.discourse.org/u/Andrew_Byrne)\
**Post date:** [Março 11, 2016, 2:33pm UTC](https://meta.discourse.org/t/post-where-causing-500-error/40896/8 "2016-03-11T14:33:42Z")

</div>

@tgxworld Thanks that helped a bunch.

For the record I was doing a bunch of stuff that I SHOULD have known better…

1. not splitting the string to an actual array (duh _facepalm_ )
2. your request seems to have fix the syntax issues (woot)

final code

```
uid = params["uid"].split(",")
tid = params["tid"].split(",")

posts = Post.where('user_id IN (?) OR topic_id IN (?)', uid, tid )
			.order(created_at: :desc)
			.limit(params["total"])
			.offset(params["start"])

obj = {follow_posts: posts }
render json: obj

```

Massive thanks!! 😃

---

_[View the full topic](https://meta.discourse.org/t/post-where-causing-500-error/40896)._
