added keyword search to find session
This commit is contained in:
parent
ceaf4119af
commit
9769ade049
|
|
@ -38,7 +38,7 @@ module JamRuby
|
|||
|
||||
# This is a little confusing. You can specify *BOTH* friends_only and my_bands_only to be true
|
||||
# If so, then it's an OR condition. If both are false, you can get sessions with anyone.
|
||||
def self.index(current_user, participants = nil, genres = nil, friends_only = false, my_bands_only = false)
|
||||
def self.index(current_user, participants = nil, genres = nil, friends_only = false, my_bands_only = false, keyword = nil)
|
||||
|
||||
query = MusicSession
|
||||
.joins(
|
||||
|
|
@ -89,6 +89,7 @@ module JamRuby
|
|||
}
|
||||
)
|
||||
|
||||
query = query.where("music_sessions.description like '%#{keyword}%'") unless keyword.nil?
|
||||
query = query.where("connections.user_id" => participants.split(',')) unless participants.nil?
|
||||
query = query.joins(:genres).where("genres.id" => genres.split(',')) unless genres.nil?
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue