Charles Fonlupt


550 Experience
5 Lessons Completed
0 Questions Solved


Unfortunately, it doesn't solve all the problem. As soon as I get a form with a date field I have the following error: .date.order only accepts :year, :month and :day, which seems to be related to a helper from rails

# _form.html.erb
<%= form.date_select :date, :default => {:month=>01,:day=>01}, :start_year=>1780 %>

I have noticed that it works perfectly if the language settings matches one of the available locales. But unfortunately as soon as the browser language does not match one of the locales I will get an I18n::InvalidLocale

I found a solution to my problem but I don't know if it's the best option:


# Configuration for internationalization options
I18n.enforce_available_locales = false
# Permitted locales available for the application
config.i18n.available_locales = [:en, :es]
# Set default locale
config.i18n.default_locale = :es
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true

I found a solution :

In the model add : searchkick word_start: [:title, :body]

def search_data
title: title,
rich_text_content: body,

@Chris : great video. I am trying to implement a similar solution but my model is using Action Text for the body and I am not able to search on that field. When I try to define a data set in my model I am not able to index the content... Any help ?

Posted in How do I build conditional form fields?

Hi Chris :

Does this issue was treated ? I have seen information on nested forms and wizzard forms, but nothing on that specific point. I would be great to hace some well documented reference.

All the best,

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2024 GoRails, LLC. All rights reserved.