arrays - Calling an object in a search method in rails -


i searching through array of hashes , need find specific objects within hash. issue getting need search model. searching this...

@insur_transactions = user.transactions.find_all { |t| (t.fetch('name').downcase! =~ /user.bill.name/) } 

the problem wont search hashes object found in bill.name. how pull object bill model , search specific item? using mongoid db.

got answer. since using regex can pull object using /#{ object }/ code looks this

@insur_transactions = user.transactions.find_all { |t| (t.fetch('name').downcase! =~ /#{user.bill.name}/) } 

that got it!


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -