Ruby on Rails
Monday, June 3, 2013
The truncate result is pool mostly time, so i think a more meaningful is useful
在 2013年6月2日星期日UTC+8上午4时30分12秒,tamouse写道:
soffolk Zhu <zlx....@gmail.com> wrote:--
> sometimes we need to truncate a long text more smart.
>
> The Model layer represents your domain model (such as Account, Product, Person, Post, etc.) and encapsulates
> the business logic that is specific to your application. In Rails, database-backed model classes are derived
> from ActiveRecord::Base. Active Record allows you to present the data from database rows as objects and
> embellish these data objects with business logic methods. Although most Rails models are backed by a
> database, models can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as
> provided by the Active Model module. You can read more about Active Record in its README.
>
> to
>
> The Model layer represents your domain model (such as Account, Product, Person, Post, etc.) and encapsulates
> the business logic that is specific to your application.
>
> I create a method content_truncate to implementation my requirement. But it is so immature for merge into
> activesupport
>
> So welcome advices
I'd use it either in a validation or a callback to the model.
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/a77a2d68-8be2-491e-81a5-4aba40dc7bf8%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment