Displaying 3 results from an estimated 3 matches for "titlecase".
2008 May 01
20
link_to meta programming question
I am trying to create a dynamic menu using the following construct:
<%- menu_list = [ ''first'', ''second'', ''third''] -%>
<ul>
<%- menu_list.each do |m| -%>
<%= link_to "List All #{m.titlecase.pluralize} <m>_path %>
<%- end -%>
</ul>
What I cannot determine is what I have to do to replace <m> so that the
link_to has a target. I have tried string substitution ("#{m}"_path)
but that gives a compile error:
_erbout.concat(( link_to "List All #{...
2006 Jan 03
0
newbie question about .titlecase of .titleize
i just started to work with ROR, and made a form with scaffolding.
I achieved to add some extra inputvalidation but i also want to add some
code that changes some specific textfields with the .titlecase /
.titleize and then stores it to the database.
I had to add the validation code to the model file, is this also the
place to add the titlecase ?
the columname of the regarding textfield is last_name(db)/lastname(ror)
--
Posted via http://www.ruby-forum.com/.
2008 May 23
20
Rails validation is inefficient
Hi,
I have a User model, with a validates_uniqueness_of :login
The generated SQL for the validation is:
SELECT * FROM `users` WHERE (LOWER(users.login) = ''fernando'' AND
users.id <> 10001) LIMIT 1;
and it takes 0.13s to happen (my table has 10.000 rows)
When I use the EXPLAIN instruction on it, it shows that it will use the
primary_key as index, but this is not