Ruby on Rails Monday, April 30, 2012

masta Blasta wrote in post #1058719:
> I'm considering making every little piece of editable content on my site
> a model with it's own table.

Call it considered, then go build something sensible.

> So if you think of a blog post for example, the title, subject, body,
> whatever....would be a separate table. With the proper associations of
> course.

I think of a blog post (object) as having a title, subject, body,
whatever (attributes).

> The reason for this is to 1.) allow for special attributes to be
> assigned to each piece of content, 2.) to allow for each piece of
> content to be edited individually via ajax.

I'm sure there are other, simpler, ways to deal with these scenarios.

> You can think of it as making everything into a component/widget.

Not even systems based entirely on components/widgets carry this idea
all the way down to the model layer. Components/widgets are
view/controller layer concerns.

> My questions are:
> 1.) How much extra strain would this be on the database. So now instead
> of just fetching one row with the data, you would query each table
> association for the right info.

I would not expect many to consider this to be a "scalable" design.

> 2.) Does anyone have any good examples/tutorials for turning every piece
> of content on your site into an ajax editable component?

I'm not aware of any. But, there has to be a better way than what you
suggest. AJAX should not in any way dictate how the model layer persists
its data. It's the job of the controller and view to collect and arrange
the data for use by the model.

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment