Hello,
I recently updated Rails to 3.0.5. The very same code that worked on
3.0.3 now gives error.
The code is:
def kategorialista
Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s|
[s.nev, s.sefuri]}
end
It is in application_controller.rb with
helper_method :kategorialista
The error it gives on 3.0.5:
SQLite3::SQLException: no such table: kategoria: SELECT "kategoria".*
FROM "kategoria" WHERE "kategoria"."elfogadva" = 't' ORDER BY nev
Obviously there is no such table as kategoria, but there is
„kategorias” table in SQLite.
Hello,
I recently updated Rails to 3.0.5. The very same code that worked on
3.0.3 now gives error.
The code is:
def kategorialista
Kategoria.where(:elfogadva => TRUE).order("nev").collect {|s|
[s.nev, s.sefuri]}
end
It is in application_controller.rb with
helper_method :kategorialista
The error it gives on 3.0.5:
SQLite3::SQLException: no such table: kategoria: SELECT "kategoria".*
FROM "kategoria" WHERE "kategoria"."elfogadva" = 't' ORDER BY nev
Obviously there is no such table as kategoria, but there is
„kategorias” table in SQLite.
Long story short: what was changed, and how to make my code work? And
why this is not mentioned in changelogs?
Looks like the inflection rules were tweaked leading rails (https://
github.com/rails/rails/commit/e925acb8 ) to think that kategoria is
pluralized to kategoria (ie that it's already a plural, like stadia).
The best thing is probably to add an inflection rule to pluralize
kategoria to kategorias.
That's great to know, but please, can you tell me how to add
inflection rule? Or how do I explicitly tell Rails to use that
specific table?
Thanks a lot,
Peter