Use AR relations to save fields/inputs and values

Instead of saving/destroying fields/inputs and values one at time
Use the Active Record relations to save these with a single save
call on the parent. This is done by adding the :autosave to the has_many
relations

It also includes the removal of to_i calls on the id fields. This will
help us when we switch to GIT and have strings as id's and the to_i
calls would fail
When we switch to a git based automate system, the objects will live in the
file system.  Thus the only way to uniquely identify them is actually by
the path.  So the file path will be the PK.
 On Nov 1, 2014 9:09 AM, "Matthew Draper" <notifications@github.com> wrote:

> In vmdb/app/controllers/miq_ae_class_controller.rb:
>
> > @@ -722,7 +722,7 @@ def edit_class
> >        id = @sb[:row_selected].split('-')
> >        @ae_class = MiqAeClass.find(from_cid(id[1]))
> >      else
> > -      @ae_class = MiqAeClass.find(params[:id].to_i)
> > +      @ae_class = MiqAeClass.find(params[:id])
>
>  To find, you can for example pass conditions with SQL fragments
>
> Not (usefully) when you're only supplying a single argument. (If you think
> you see a way, please do let security@rubyonrails.org know.)
>
> Rails change over the time
>
> Well since 4.0, find is much curtailed, and now *only* accepts IDs. I
> don't foresee that opening up again.
>
> Anyway, this just caught my attention because if
> SomeModel.find(params[:id]) is unsafe, then *a lot* of apps have an issue.
> ------------------------------
>
> To venture back to the root topic, however: I would strongly discourage
> the use of the git commit sha as the PK. The AR Way is to use a surrogate
> key, and disregarding that seems to be courting future pain for minimal
> benefit.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ManageIQ/manageiq/pull/961/files#r19704016>.
>