i am not sure but try this
truncate("Once upon a time in a world far far away", :length => 17,
:separator => ' ') or
write the outputs examples which you want to come
On Mon, Oct 11, 2010 at 1:45 AM, nobosh <[email protected]> wrote:
> Here is the truncate code I'm using:
>
> <%= truncate(teammember.user.full_name, :length => 8)%>
>
> teammember.user.full_name returns names like:
> - Steve Jobs
> - Larry Oracle
> - James Bond
> - Dhandar Kentavolv
>
> Butall the truncate is doing is returning:
> - Steve Jobs...
> - Larry Oracle...
> - James Bond...
> - Dhandar Kentavolv...
>
>
> The user.full_name is not a field in the DB but a helper in the user
> model, which might be the issue.?
>
> def full_name
> if !fname.nil? && !fname.empty?
> [fname, lname].join(" ")
> else
> ['User', id].join(" ")
> end
> end
>
> I then tried:
> <%= truncate("Once upon a time in a world far far away", :length =>
> 1)%>
> And that returns: Once... and not O...
>
>
> Any ideas? thanks!
>
> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
Thanks:
Rajeev sharma
--
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.