[Git][noosfero/noosfero][master] pg-search: convert rails parameter to hash

Rodrigo Souto gitlab at mg.gitlab.com
Mon Jun 3 13:53:53 BRT 2019



Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
0255f6de by Rodrigo Souto at 2019-06-03T16:53:32Z
pg-search: convert rails parameter to hash

- - - - -


1 changed file:

- plugins/pg_search/lib/pg_search_plugin.rb


Changes:

=====================================
plugins/pg_search/lib/pg_search_plugin.rb
=====================================
@@ -50,7 +50,7 @@ class PgSearchPlugin < Noosfero::Plugin
 
   def active_filters asset, scope, params, query = nil
     facets  = params[:facets] || {}
-    periods = params[:periods] || default_periods_for(asset)
+    periods = (params[:periods] || default_periods_for(asset)).to_h
     query ||= params[:query] || params[:q]
     block = Block.find_by id: params[:block]
 
@@ -108,7 +108,7 @@ class PgSearchPlugin < Noosfero::Plugin
     facets.each do |term, values|
       kind, klass = term.split('-')
       if kind == 'attribute' || kind == 'relation' || kind == 'metadata'
-        arguments = values.map {|value, check| value if check == '1'}.compact
+        arguments = values.to_h.map {|value, check| value if check == '1'}.compact
         arguments.map! {|argument| argument == ' ' ? nil : argument}
       else
         next



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/0255f6defdb9657b0a033f2143bfeb1463d939b6

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/0255f6defdb9657b0a033f2143bfeb1463d939b6
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20190603/ea04eea9/attachment.html>


More information about the Noosfero-dev mailing list