Skip to content

prepare_parameters raises exception when parameters nil #345

Open
@tillcarlos

Description

@tillcarlos

Hey guys. First: great work! This is exactly the gem I was searching for.

On my dev+production machine sometimes activities get created with parameters being nil.

Then this code fails

    def prepare_parameters(params)
      @prepared_params ||= self.parameters.with_indifferent_access.merge(params)
    end

with_indifferent_access called on nil object.

I'm fixing it in the view with this:

<% @activities.each do |activity| %>
  <% activity.parameters ||= {} %>
  <%= render_activities(activity) %>
<% end %>

But it's weird that it's necessary. Maybe because I changed my migration to t.json "parameters" ? Default was text, but that crashed on my production machine (a vanilla dokku install... I did not check why text did not work, but json worked. If it's relevant I can investigate).

Wouldn't it make sense to just put in the default? Or change that method to always hand out at least empty hash? {}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions