Monday, May 6, 2013

Re: [Rails] Re: Getting started w/ Rails 4

On 6 May 2013 05:53, rihad <rihad@mail.ru> wrote:
> Hi, Colin, you see, I think that listing permitted fields all over
> again in the controller can be viewed as repetitiveness.

There is no repetition as this is not listing the fields "all over
again". This is just specifying which fields may (or must) be mass
assigned.

> Ideally,
> model would just accept the bulk of fields coming from the outside,
> validate their presence + conformance, and yell if it isn't the case.
> How it is being done now ensures greater flexibility in that
> controller can massage + glue up several fields into one etc. before
> passing them all to the model. This is good, and I'm not saying this
> functionality shouldn't be available, but in the simplest case,
> Post.save(params[:post]) should just do the obvious by adhering to
> convention over configuration. Just my opinion.

It was like that in rails originally I believe, but it is just too
dangerous. It was too easy for the developer to forget to protect the
fields that should not be mass assigned.

>
> p.s. I don't believe I've top-posted in this thread? Well, unless you
> believe that a few of my quote-less posts, such as this one, are top-
> posting. I simply click "reply" under relevant post.

You are right, I assumed that you had top posted as it was at the top.
Rather you had committed the (arguably) even worse sin of not quoting
the relevant parts of previous message. This means that your latest
message, for example, has no context so one has to look back through
previous emails to find out what it is about.

Colin

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate