meta-search

Check boxes search with Ransack gem

情到浓时终转凉″ 提交于 2020-06-09 11:39:51
问题 I need to filter data in a table. To do this, I found meta_search gem. I installed meta_search and I get this error: uninitialized constantActiveRecord::Associations::ClassMethods::JoinDependency This is deprecated for Rails 4 (framework that I'm using). So, I installed ransack (rails 4 branch) (gem based on meta_search) and works beautifully. The problem is that I need to use the meta_search's collection_checks method to handle check boxes and this method does not exist in ransack. So, the

Check boxes search with Ransack gem

一个人想着一个人 提交于 2020-06-09 11:39:10
问题 I need to filter data in a table. To do this, I found meta_search gem. I installed meta_search and I get this error: uninitialized constantActiveRecord::Associations::ClassMethods::JoinDependency This is deprecated for Rails 4 (framework that I'm using). So, I installed ransack (rails 4 branch) (gem based on meta_search) and works beautifully. The problem is that I need to use the meta_search's collection_checks method to handle check boxes and this method does not exist in ransack. So, the

Rails meta_search gem: sort by count of an associated model

僤鯓⒐⒋嵵緔 提交于 2019-12-21 09:00:43
问题 I'm using meta_search to sort columns in a table. One of my table columns is a count of the associated records for a particular model. Basically it's this: class Shop < ActiveRecord::Base has_many :inventory_records def current_inventory_count inventory_records.where(:current => true).count end end class InventoryRecord < ActiveRecord::Base belongs_to :shop #has a "current" boolean on this which I want to filter by as well end In my Shop#index view I have a table that lists out the current

Rails meta_search gem: sort by count of an associated model

夙愿已清 提交于 2019-12-21 09:00:29
问题 I'm using meta_search to sort columns in a table. One of my table columns is a count of the associated records for a particular model. Basically it's this: class Shop < ActiveRecord::Base has_many :inventory_records def current_inventory_count inventory_records.where(:current => true).count end end class InventoryRecord < ActiveRecord::Base belongs_to :shop #has a "current" boolean on this which I want to filter by as well end In my Shop#index view I have a table that lists out the current

Integrating meta_search gem in index with existing geocoder gem search (rails)

落爺英雄遲暮 提交于 2019-12-14 00:50:08
问题 I have already implemented a location based search using geocoder and am having trouble integrating the meta_search gem. I'm trying to integrate meta_search into my object_controller index to allow users to filter and sort search results by an objects :attributes after they have already searched by location. My object_controller: def index if params[:search].present? @objects = Object.near(params[:search], 50, :order => :distance).paginate(:page => params[:page], :per_page => 9) else @objects

Metasearch rails gem multiple time search by field

孤者浪人 提交于 2019-12-13 00:38:27
问题 I have such code of searching (with metasearch rails gem): @pre_oils = Oil.search({:manufacturer_like => params[:oilbrand], :description_like => params[:oiloiliness], :description_like => params[:oilstructure], :capacity_eq => params[:oilsize]}) But i must to search via description with like on two params: oiloiliness, oilstructure... In some cases i could have first, but didn'r have oilstructure or have oilstructure but didn't have oiloiliness... if i leave @pre_oils = Oil.search({

Does Ransack support the same polymorhpic belongs_to associations in its searches as MetaSearch does?

时间秒杀一切 提交于 2019-12-12 09:52:56
问题 I am migrating from the MetaSearch gem to the Ransack gem for an upgrade to Rails 3.1 and I am having problems with my searches for polymorphic associations. The existing MetaSearch syntax isn't working for Ransack, but I couldn't find any documentation mentioning any syntax changes. Or whether this feature is supported in Ransack. For example, from the MetaSearch github page, given the following classes: class Article < ActiveRecord::Base has_many :comments, :as => :commentable end class

Sorting in named_scope through 2 tables with condition

老子叫甜甜 提交于 2019-12-11 12:18:30
问题 I am looking for solution how to sort by attribute which is two association levels deep and also have an condition. I have order model which HAS TO have association with Shop model OR Warehouse model both of these models are associated with country which has a name. My goals are: Scoped the orders and sort by country name. Result has to be a ActiveRelation object And the main goal is use this scope for MetaSearch gem for view helper sort_link class Order < ActiveRecord::Base belongs_to :shop

MetaSearch Gem - Rails 3.0 working scope methods fail in Rails 3.2

本小妞迷上赌 提交于 2019-12-11 10:37:16
问题 MetaSearch's handy functions such as .not_in worked in Rails 3.0 & 3.1 inside of scope calls. I had to rewrite some scopes to be "plain Rails 3.2" without MetaSearch convenience even though MetaSearch works outside of scope. And it broke several of my apps & tools when I upgraded. Ideas? I am using MetaSearch everywhere. Even wrote a custom predicate. Still could be missing something obvious I hope. On Rails 3.2, working inside an engine for code separation. Didn't seem to matter when I tried

Meta_Search undefined method error

大兔子大兔子 提交于 2019-12-11 06:57:59
问题 Intro: I am working on a Car dealer application so I have a table named cars with fields carname_id and carmodel_id. carname_id and carmodel_id are taken from 2 tables named carnames and carmodels where I keep all car names and car models. Now I've setup these models so I can have them in a relation, something like belongs_to and has_many (not relevant cause this is working as it should be - I can add cars and models to a new car from a select list) I am using meta_search to search by many