Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing multi-lang entities that are searchable fail in some cases #4079

Closed
tramuntanal opened this issue Sep 5, 2018 · 0 comments
Closed
Assignees
Labels
module: core type: bug Issues that describe a bug

Comments

@tramuntanal
Copy link
Contributor

Describe the bug
Editing multi-lang entities that are searchable (like meetings) crash when coexist, in a single installation, many organizations with different locales each.

The cause is probably the has_many :searchable_resources in the Searchable concern that is not scoping by decidim_organization_id and neither filtering by resource_type (I guess it needs :source_type, but I'm not sure).

To Reproduce
Steps to reproduce the behavior, in a single Decidim installation:

  1. Create two organizations with different locales each.
  2. Create searchable entities in one of them, one is enough.
  3. Create a Meeting in the other.
  4. Edit the former Meeting
    5 crash!

Expected behavior
Editing any searchable resource should succeed, even when the organizations in the same tenant have different locales.

Stacktrace

I, [2018-09-05T13:52:59.954005 #19221]  INFO -- : [b02d3978-d59c-422b-aa48-491273708d1f] Completed 500 Internal Server Error in 130ms (ActiveRecord: 10.2ms)
F, [2018-09-05T13:52:59.960172 #19221] FATAL -- : [b02d3978-d59c-422b-aa48-491273708d1f]   
F, [2018-09-05T13:52:59.960563 #19221] FATAL -- : [b02d3978-d59c-422b-aa48-491273708d1f] NoMethodError (undefined method `[]' for nil:NilClass):
F, [2018-09-05T13:52:59.960771 #19221] FATAL -- : [b02d3978-d59c-422b-aa48-491273708d1f]   
F, [2018-09-05T13:52:59.961033 #19221] FATAL -- : [b02d3978-d59c-422b-aa48-491273708d1f] decidim-core (0.14.0) lib/decidim/searchable.rb:67:in `contents_to_searchable_resource_attributes'
[b02d3978-d59c-422b-aa48-491273708d1f] decidim-core (0.14.0) lib/decidim/searchable.rb:55:in `block in try_update_index_for_search_resource'
[b02d3978-d59c-422b-aa48-491273708d1f] activerecord (5.2.0) lib/active_record/relation/delegation.rb:41:in `each'
[b02d3978-d59c-422b-aa48-491273708d1f] activerecord (5.2.0) lib/active_record/relation/delegation.rb:41:in `each'
[b02d3978-d59c-422b-aa48-491273708d1f] decidim-core (0.14.0) lib/decidim/searchable.rb:54:in `try_update_index_for_search_resource'
[b02d3978-d59c-422b-aa48-491273708d1f] activesupport (5.2.0) lib/active_support/callbacks.rb:426:in `block in make_lambda'
[b02d3978-d59c-422b-aa48-491273708d1f] activesupport (5.2.0) lib/active_support/callbacks.rb:236:in `block in halting_and_conditional'
[b02d3978-d59c-422b-aa48-491273708d1f] activesupport (5.2.0) lib/active_support/callbacks.rb:517:in `block in invoke_after'
[b02d3978-d59c-422b-aa48-491273708d1f] activesupport (5.2.0) lib/active_support/callbacks.rb:517:in `each'
[b02d3978-d59c-422b-aa48-491273708d1f] activesupport (5.2.0) lib/active_support/callbacks.rb:517:in `invoke_after'
[b02d3978-d59c-422b-aa48-491273708d1f] activesupport (5.2.0) lib/active_support/callbacks.rb:133:in `run_callbacks'
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: core type: bug Issues that describe a bug
Projects
None yet
Development

No branches or pull requests

2 participants