Perhaps due to the protect_from_forgery line in your application.rb file. Try commenting this out and see if it works, if you don’t care about people forging your forms
Perhaps due to the protect_from_forgery line in your application.rb
file.
Try commenting this out and see if it works, if you don't care about
people
forging your forms
<% for bestemming in @bestemmingen -%>
<%= bestemmingen.naam %>
<% end -%>
Well, you’re using a non-existent local variable “bestemmingen” instead of “bestemming” as you named it in the first line.
I doesn’t work…anymore…
Must i use the helper “auto_complete_result” or is my partial-code not
good?
Also remember that Rails as a framework uses English as its main language, you’ll run into problems sooner or later because the singular/plural inflectors can never do their job well. Even if you would like to make your urls make sense to a Dutch-speaking person, you could still use English controller names, English named models and fields and just adjust your routes file to hide the default English name and replace it with the Dutch version.
Your models shouldn’t be a problem at all, since the MVC model implies that your user will never see model names throughout the application. If you want your field names to be translated, you can use simple_localization (http://simple-localization.arkanis.de/)), which I prefer over Globalize. It will allow you to map the fieldnames to the translation.
Using your “bestemmingen” example, something like this should work:
If you want to keep your Dutch model names, you can define your pluralization rules globally in /config/initializers/inflections.rb (Rails 1: config/environment.rb), like this:
Inflector.inflections do |inflect|
inflect.plural /([aeou])+([^aeiouy])$/i, '\1\2en'
inflect.singular /([aeou])([^aeiouy])en$/i, '\1\1\2'
inflect.plural /([^aeiouy])$/i, '\1en'
inflect.singular /([^aeiouy])en$/i, '\1'
end
or if you're not good at regexen, just do it per model name:
Inflector.inflections do |inflect|
inflect.irregular 'land', 'landen'
...
For anything that doesn't match your custom rules, the default English rules are used.
But it's tricky. I've tried it for German, kept running into errors and ended up refactoring to English table names. Dutch plurals are simpler, so it could work for you.