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

Refactor define_restrict_dependency_method using reflection #4835

Merged
merged 1 commit into from May 19, 2012
Merged

Refactor define_restrict_dependency_method using reflection #4835

merged 1 commit into from May 19, 2012

Conversation

pacoguzman
Copy link
Contributor

We need to know if the reflection macro is equal to has_one in two lines so I'd cached in a variable

@isaacsanders
Copy link
Contributor

Is this still an issue?

@pacoguzman
Copy link
Contributor Author

@isaacsanders only a little refactor, IMHO reflects better what happening there

@@ -69,12 +69,12 @@ def dependent_restrict_deprecation_warning
def define_restrict_dependency_method
name = self.name
mixin.redefine_method(dependency_method_name) do
# has_many or has_one associations
if send(name).respond_to?(:exists?) ? send(name).exists? : !send(name).nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as has_one_macro in the code below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this commit - 336ff8a

the code is splitted in two files has_one and has_many with that condition so IMHO is the same, in some later commits we merge that code in an unique place

carlosantoniodasilva added a commit that referenced this pull request May 19, 2012
…endency_method

Refactor define_restrict_dependency_method using reflection
@carlosantoniodasilva carlosantoniodasilva merged commit 8405aad into rails:master May 19, 2012
@carlosantoniodasilva
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants