merit-gem / merit

Reputation engine for Rails apps
Other
1.52k stars 197 forks source link

Relation "sashs" does not exist AND relation "merit_scor_points" does not exist #323

Closed marcodotcastro closed 5 years ago

marcodotcastro commented 5 years ago

I followed all the steps of the readme configuration, however when executing any merit method the following error occurs.

Usuario.last.add_points(20)

ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: relation "sashs" does not exist)

tute commented 5 years ago

Hi @marcodotcastro. That's because your app is configured in a language for which Rails doesn't know how to pluralize sash. Adding this to an initializer or app configuration should fix it:

# Change :en with your language
ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.irregular "sash", "sashes"
end
marcodotcastro commented 5 years ago

Of course, I forgot that detail. Thanks a lot for the help.

But I believe this is a bug, as I tried the same solution it did not work.

ActiveRecord :: StatementInvalid (PG :: UndefinedTable: ERROR: relation "merit_scor_points" does not exist)

tute commented 5 years ago

That would be (I think):

# Change :en with your language
ActiveSupport::Inflector.inflections(:en) do |inflect|
  inflect.irregular "sash", "sashes"
  inflect.irregular "merit_score_points", "merit_score_points"
end
marcodotcastro commented 5 years ago

I tried both. And it did not work.

inflect.irregular "merit_scor_points", "merit_score_points"

inflect.irregular "merit_score_points", "merit_score_points"

tute commented 5 years ago

inflect.irregular "merit_score_point", "merit_score_points"?

marcodotcastro commented 5 years ago

It worked. Thank you very much. God bless your service.