internationalization - Keeping track of changes using rails - "changed?" -


I am building a multilingual website, using Ruby on Rails, where the user creates part of the content And they should be able to create different versions of it for all languages. Language support is controlled by the I18n gem.

Part of your content is created through Markdown.

In my database I save: object.content_markdown_en, object.content_html_en, object.content_markdown_sv, Object.content_html_sv and other places.

Now if a user changes the content, the new HTML is generated.

I thought there might be a way to do something like this

  if object.content_markdown_ [locale] _changed? Gener_new_html termination   

which can be run in one loop for all possible locations, but I can not find a good way to do this.

How about:

  [: en ,: sv ] .each do | Locale | Send object.send ("content_markdown _ # {locale} _changed?". To_sym) ("gener_new _ # {locale} _html" .to_sym} end to end    

Comments