here's what i tried
has "if(messages.restricted=0,'0',concat_ws(',',group_concat
(groups_messages.group_id SEPARATOR ','),group_concat(-
messages_users.user_id SEPARATOR ','),-messages.creator_id))", :as
=> :visibility, :type => multi
so basically creating array (f.ex. [-5,-2,-1,0,8,10]) where negative
numbers are user ids[-5,-2,-1], 0 for not restricted and positive nums
for group ids [8,10]
(i know it's weird, but ..)
and for search
Message.search "foo", :with => {
:visibility => [-
current_user.id]+[0] +
current_user.message_group_ids
}
but apparently "with" doesn't see a difference between negative and
positive numbers, or there is some conversion which makes it loose the
"-" sign
is there a way to change this behaviour?
also, using the above "has" produced "ERROR: index 'message_core':
sql_range_query: Unknown column 'groups_messages.group_id' in 'field
list' (DSN=mysql://mysql:***@localhost:3306/
simplecommunities_development)."
but this was fixed with
has groups_messages.group_id
has messages_users.user_id
any advice on negative/positive numbers?
i also tried 'u1','u2','u3','u5',0,1,2,4 pattern (same as minus but
with 'u'), but with same result
thanks