Write Ruby Hash with duplicate values without repeating value -


i have following code in rails controller:

@users = user.where(["first_name = :first_name or                     last_name = :last_name or                     company = :company",                     { first_name: term, last_name: term,                     company: term }]) 

term term = params[:search]

i don't i'm repeating term

{ first_name: term, last_name: term,                         company: term } 

is there dryer way accomplish this?

thank you!

you can this:

@users = user.where("first_name = :term or   last_name = :term or company = :term", term: term) 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -