草庐IT

search_n

全部标签

ruby-on-rails - Rails 的 Ransack Search,带有关联模型的 check_box

我在使用RailsSerchinggem“ransack”时迷路了。我想做的是为关联模型设置复选框。这是我的代码。shows_controller.rbclassShowsControllertrue)@shows=@shows.joins(:tickets)respond_todo|format|format.html#index.html.erbformat.json{renderjson:@shows}endendindex.html.erbAtVenueTicketmaster|显示.rbclassShow门票.rbclassTicket当我在search_field中输入内容

ruby - 最新的 ruby 在哪里 : Ruby gems equivalent of search. cpan.org/recent

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。关闭6年前。ImprovethisquestionPerl有一个叫做“http://search.cpan.org/recent”的地方人们可以在这里看到哪些是最新添加到CPAN的模块。ruby程序员在哪里可以找到“最新添加到ruby​​gems索引中的gems是什么”?

ruby-on-rails - rails : Implement Search/Filter like Amazon. com

我正在尝试在基于多个属性的模型上实现搜索功能。我想让用户能够指定要过滤的属性。它与任何电子商务网站(如Amazon.com)非常相似例如,用户可以根据以下条件进行过滤-作者-评分-类别任何建议将不胜感激! 最佳答案 这种方法通常称为“分面”搜索。尝试:http://railscasts.com/episodes/306-elasticsearch-part-1http://railscasts.com/episodes/307-elasticsearch-part-2https://github.com/elasticsearch/

ruby-on-rails - 使用 Active Admin 和 Elastic Search 时 Ransack::Search 的未定义方法 `each'?

您好,我一直在使用Railcasts#306(http://railscasts.com/episodes/306-elasticsearch-part-1)作为示例在我的应用程序中使用ElasticSearch。在我安装ActiveAdmingem之前一切正常。当我在shops#index页面中传递查询时,出现以下错误:Ransack::Search的未定义方法“each”>:Ransack::Search知道为什么它使用Ransackgem(而不是ElasticSearch)进行搜索吗?下面是与搜索相关的代码片段:商店.rb:classShopshops_controller.rb

sql - Rails 4 "where"-query with "has_many belongs_to"-relationship, search with specific count

这应该是一个简单的查询,但我在正确使用Rails语法时遇到了问题。我正在使用Rails4.1.1和Postgresql(9.3)。我有一个模型用户和模型公司。User有一个公司,Company有很多用户。我试图找到所有拥有5个以上用户的公司。classCompany问题类似于:Findallrecordswhichhaveacountofanassociationgreaterthanzero如果我尝试上述类似的解决方案:Company.joins(:users).group("company.id").having("count(users.id)>5")它给我一个错误:PG::Un

ruby-on-rails - Elasticsearch 和 Rails : Using ngram to search for part of a word

我正在尝试在我的项目中使用Elasticsearch-Gem。据我了解:现在已经不需要轮胎gem了,还是我错了?在我的项目中,我有一个搜索(很明显),它目前适用于一个模型。现在我试图避免使用通配符,因为它们不能很好地扩展,但我似乎无法让ngram-Analyzers正常工作。如果我搜索整个单词,搜索仍然有效,但部分无效。classPictures{:analyzer=>{:my_index_analyzer=>{:tokenizer=>"keyword",:filter=>["lowercase","substring"]},:my_search_analyzer=>{:tokeniz

ruby-on-rails - ruby rails : Custom routes for search results

我正在构建一个供用户提交“冒险”的应用程序,我希望设置各个页面以按城市显示冒险。我按照这个建议(RubyonRails4:DisplaySearchResultsonSearchResultsPage)将搜索结果显示在一个单独的页面上,效果很好,但我想更进一步,并有预先设置的链接来将用户引导到特定城市的冒险事件。我不确定如何从http://localhost:3000/adventures/search?utf8=%E2%9C%93&search=Tokyo获取结果以显示在http://本地主机:3000/页面/东京。另外,我对Rails很陌生;这是我的第一个项目。routes.rbr

ruby-on-rails - rails : Cannot include PgSearch Module provided by the pg_search Gem

总结:Gempg_search提供的模块PgSearch无法包含、要求或加载到登台环境(Rbenv、nginx、unicorn、capistrano),问题通过http发生在Web服务器上,但不会出现在登台服务器的rails上命令。可以包含其他gem提供的其他模块而不会出错。在本地开发环境(rvm、puma)上没有问题。详情我目前正在使用ruby​​2.0.0开发一个RubyOnRails4.0应用程序,其git存储库托管在bitbucket上。我使用Capistrano通过临时服务器部署应用程序。暂存服务器环境:rbenv、nginx和unicorn本地开发环境:rvm和puma两者

ruby - 为什么我在使用 Nokogiri "search"时会得到错误的输出?

我想从CarFax报告的特定div中抓取数据。但是,当我搜索div时,我总是得到这种奇怪的垃圾输出。我试过了search(#divId),search(.divClass),甚至试图用search('div')获取所有div.每次我都得到类似的结果:div的内容被部分截断,标签全乱了。这是我加载到我的agent中的URL:https://gist.github.com/atkolkma/8024287这是代码(省略了用户和密码):require"rubygems"require"mechanize"scraper=Mechanize.newscraper.user_agent_alia

ruby-on-rails - 如何覆盖 lib/spree/search/base.rb

我需要覆盖此类中的get_products_conditions_for方法,最好的方法是什么?我已经尝试将其添加到初始化程序中:Spree::Search::Base.class_evaldodefget_products_conditions_for(base_scope,query)base_scope.like_any([:name,:description],query.split)|base_scope.joins("JOINtaggingsontaggings.taggable_id=spree_products.idJOINtagsontags.id=taggings.