Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename ActiveModel::Model to ActiveModel::BasicModel #5384

Closed
wants to merge 2 commits into from

Conversation

cgriego
Copy link
Contributor

@cgriego cgriego commented Mar 12, 2012

This module provides the sets of features required to support the ActiveModel API and no more. Its naming is meant to be reminiscent of Ruby's Object and BasicObject.

@josevalim
Copy link
Contributor

👎 for removing the initialize method implementation. I prefer an implementation that is practical than one that fits a conceptual purpose of mapping to BasicObject.

@cgriego
Copy link
Contributor Author

cgriego commented Mar 14, 2012

@josevalim I've added back the initialize method as ActiveModel::MassAssignment. It's anemic for now but will grow as people find need for mass assignment security and the other ActiveRecord like methods (attributes=, assign_attributes). This is such a common piece of code that there's no reason to believe that people needing mass assignment functionality also need to support the ActiveModel API, provided by BasicModel. For example, this presentation repeats the code twice in classes that never interface with ActionPack.

@josevalim
Copy link
Contributor

MassAssignment is being re-evaluated for Rails 4. That said, let's put a
halt on this patch until we define how MassAssignment is going to look
like.

@cgriego
Copy link
Contributor Author

cgriego commented Apr 28, 2012

@josevalim Is mass assignment still being re-evaluated for Rails 4?

@josevalim
Copy link
Contributor

Yes, we will like move Rails to use something like strong_parameters.

@cgriego
Copy link
Contributor Author

cgriego commented May 1, 2012

Ok, so strong_parameters in its current form depends on the model class calling sanitize_for_mass_assignment, which nothing in ActiveModel does today. An ActiveModel::MassAssignment module would be the best place to add that feature for use in non-ActiveRecord models.

@josevalim Is there anything else pending the acceptance of this pull request?

@steveklabnik
Copy link
Member

This doesn't merge cleanly any more, and will need a rebase.

@cgriego
Copy link
Contributor Author

cgriego commented May 17, 2012

@steveklabnik I've rebased, it should merge cleanly now.

@steveklabnik
Copy link
Member

GitHub still says no, though maybe it's caching is a bit out of date. I know @tenderlove was talking about some weirdness on Twitter today...

@cgriego
Copy link
Contributor Author

cgriego commented May 20, 2012

@steveklabnik I've just merged the branch cleanly with the current master locally. Does GitHub agree now?

@josevalim
Copy link
Contributor

It merges cleanly now but something is wrong, it says we have more than 250 commits to be merged.

@vendethiel
Copy link
Contributor

It's been merged, merging then other comments, and became a whole mess ._.

@cgriego
Copy link
Contributor Author

cgriego commented May 20, 2012

@josevalim Every way I check it looks clean on my end. I think GitHub got confused. I can submit as a new pull request if you like but I'd hate for it to sit as long as this one has.

@steveklabnik
Copy link
Member

You should do this:

$ git checkout master
$ git fetch upstream
$ git reset --hard upstream/master
$ git checkout rename-model-to-basic-model
$ git reset --hard upstream/master
$ git cherry-pick SOME_SHA
<repeat for all commits>
$ git push origin rename-model-to-basic-model --force

Where SOME_SHA is the sha of the commit you want. Or commits. I forget if there are multiple.

I'd be happy to help walk you through this if you're unsure about it. Basically just resetting EVERYTHING to make sure it's current with master and making only the changes on your branch. GitHub should automatically update the pull request.

This module provides the sets of features required to support the ActiveModel API and no more. Its naming is meant to be reminiscent of Ruby's Object and BasicObject.
@cgriego
Copy link
Contributor Author

cgriego commented May 21, 2012

Rebasing again seems to have fixed GitHub's view of the pull request. But for the record, the tree was clean.

* 7c95be5 (rails/master, rails/ambiguous_controller_fix) Fix generators to help with ambiguous `ApplicationController` issue
* [abbreviated]
* 47971a1 Merge pull request #6360 from bcardarella/logger_debug_fix
| * 8125042 (rename-model-to-basic-model) Added ActiveModel mass assignment back in as ActiveModel::MassAssignment
| * 3ecdda7 Rename ActiveModel::Model to ActiveModel::BasicModel
|/
* 251b22f Don't need to force size to nil

@frodsan
Copy link
Contributor

frodsan commented Oct 27, 2012

👎 Is this split really worthwhile?

@frodsan
Copy link
Contributor

frodsan commented Oct 29, 2012

@cgriego Could you please rebase it?

@rafaelfranca
Copy link
Member

I'm fine with the rename. But I don't like the idea of the MassAssignment module. I don't see why we need to split.

@frodsan
Copy link
Contributor

frodsan commented Oct 29, 2012

This is a duplicate of #8064. I'm closing here to continue the discussion there.

@cgriego Thanks!!!

@frodsan frodsan closed this Oct 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants