magiclabs/alchemy_cms — Issue #144: Infinite loop if no (default) language is in database
Author: masche842
Created: 2012-01-18 05:34:05+00:00
State: open
Labels: bug, refactor

Alchemy's Base controller defines the two methods set_language_to_default and store_language_in_session.
If there's no default language (or no language at all) they keep calling each other, thus causing an infinite loop.

Although the system should never be in that state (no language in db), especially alchemy-newbies tend to forget the "rake alchemy:db:seed"-step.
For their convenience (and to avoid any infinite loops in general...) this should be refactored.

Possible solutions:
- raise an exception if there is no (default) language in database
-> this causes problems with the fore mentioned rake task, it should be refactored then as well
- detect the loop in the controller and show an error message ("Please execute the rake task first!")