mbleigh/acts-as-taggable-on — pull request #585 by konukhov (2014-08-31 23:55:03+00:00)
Title: fix owned ordered taggable bug

Hi again guys.

I got an email from a dude who ran into a nasty bug.

For example you have an ordered taggable model:
```ruby
class MyTaggable < ActiveRecord::Base
acts_as_ordered_taggable
end
```

and a simple user model:

```ruby
class User < AR::Base
acts_as_tagger
end
```

Let's open rails console:
```ruby
user = User.last
my_taggable = MyTaggable.last

# this model has already been tagged before
my_taggable.tags_from(user) # => ['tag1', 'tag2', 'tag3']
```
I chose tags and their order to get [into this block](https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/acts_as_taggable_on/taggable/ownership.rb#L94)

```ruby
# then you wanna change tags and their order.
@user.tag(@my_taggable, with: "tag3, tag2", on: :tags) #=> and you got....

ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near "0"
LINE 1: SELECT "tags".* FROM 0 INNER JOIN "taggings" ON "tags"."id" ...
^
```
Because of this ["from" method](https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/acts_as_taggable_on/taggable/ownership.rb#L97) which is being called from Relation class instead of Array.

Here's a fix and a test that recreates this behaviour.