Giter Club home page Giter Club logo

Comments (5)

gtarsia avatar gtarsia commented on July 24, 2024 2

@kuroda I agree with @jrochkind, dynamic_form gem does not work for me.
Instead, this worked for me:
<%= t('errors.template.header', :model => Model.model_name.human, :count => model.errors.count) %>

from rails-i18n.

alexeymuranov avatar alexeymuranov commented on July 24, 2024

Thanks for looking at it!

Alexey.

from rails-i18n.

kuroda avatar kuroda commented on July 24, 2024

Hi, Alexey

Look at the app/views/users/_form.html.erb generated by scaffold. The error message is hard coded. So, changing the locale file has no effect.

Actually, the Rails 3.0 does not utilize the activerecord.errors.template.header translation. In the Rails 2.x, this translation is used in the error_messages method of the form builder, but this method is deprecated and extracted as a plugin.

If you are curious, do the following:

  • rails plugin install git://github.com/joelmoss/dynamic_form.git
  • Edit app/views/_form.html.erb as follows:
<%= form_for(@user) do |f| %>
  <%= f.error_messages %>

  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

from rails-i18n.

alexeymuranov avatar alexeymuranov commented on July 24, 2024

Thank you, i have overlooked this.

from rails-i18n.

jrochkind avatar jrochkind commented on July 24, 2024

finding this way later, scaffold still generates hard-coded error text, but f.error_messages doesn't seem to exist anymore as a method on the form builder.

The i18n data is still in the repo.... not sure how to use it!

from rails-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.