Ruby on Rails
Saturday, January 26, 2019
On Saturday, January 26, 2019 at 6:58:17 PM UTC-5, Walter Lee Davis wrote:
> On Jan 26, 2019, at 5:27 PM, fugee ohu <fuge...@gmail.com> wrote:
>
> TypeError: no implicit conversion of Symbol into Integer
> from app/models/press_release.rb:17:in `truncated_headline'
>
>
> class PressRelease < ApplicationRecord
>
> extend FriendlyId
> friendly_id :truncated_headline, use: :slugged
>
>
> def truncated_headline
> # cut off at 200 characters, without an ellipsis
> headline.truncate(255, '')
> end
>
Aha. truncate takes named arguments past the first one. The correct signature is
headline.truncate(255, omission: '')
This should work.
Walter
Still rolling back
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/28107589-3440-4f0c-b09a-c5193d2e664f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment