soffolk Zhu <zlx.star@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/51aa59d5.a66f320a.69f8.ffffceb2%40mx.google.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment