If I should believe the things I find on the internet, this is the
correct approach for form labels:
---
en:
  activerecord:
    attributes:
      user:
        last_name: Surname
---
And then:

<% form_for @user do |f| %>
  <%= f.label :last_name %>
  <%= f.text_field :last_name %>
<% end %>

However, this results in a form label "Last name" instead of
"Surname". What am I doing wrong? I'm on Rails 2.3.5.

Also, to expand on my first problem a bit, I'd like to have the
following en.yml:
---
en:
  title: "My Website"
  home:
    index:
      title: "Home"
  users:
    new:
      title: "New User"
---
Now, if I go to /home/index, I'd like my title to be "Home". If I got
to /users/new, I'd like my title to be "New User". If I go to any
other page, the title'd be "My Website". I've read up on this and I
thought I had the right approach by simply putting t(:title) in the
title tag of my layout, but that doesn't seem to work. What is the
right approach?

Of course, I could always make a helper:

def display_title
  title = t("#{params[:controller]}.#{params[:action]}.title")
  title = t(:title) if title.blank?
end

However, Rails is so friggin' powerful, I can't believe there's
nothing built in for both my problems.

I'd really appreciate it if anyone could think with me. Thanks in
advance.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to