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

Use normal variable name over _ when block variable is used #1871

Merged
merged 1 commit into from
Mar 5, 2013
Merged

Use normal variable name over _ when block variable is used #1871

merged 1 commit into from
Mar 5, 2013

Conversation

dbussink
Copy link
Contributor

_ is generally used and intented for ignoring options. It allows for
having multiple _ parameters for example. The behavior of this is also
not consistent across at least Ruby 1.8 and 1.9, where on 1.8 it is the
value nil, on 1.9 it works somewhat like a regular name.

To avoid all this confusion, this commit changes it to use a regular
name. This also fixes a bug running in Rubinius 1.9 mode (this behavior needs to be fixed there as well).

@@ -79,7 +79,7 @@ def build_table_header(col)
def build_table_body
@tbody = tbody do
# Build enough rows for our collection
@collection.each{|_| tr(:class => cycle('odd', 'even'), :id => dom_id(_)) }
@collection.each{|e| tr(:class => cycle('odd', 'even'), :id => dom_id(e)) }
Copy link
Contributor

Choose a reason for hiding this comment

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

You might want to use elem instead of e to make it a bit more explicit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If that would be preferred, I can change it to that

_ is generally used and intented for ignoring options. It allows for
having multiple _ parameters for example. The behavior of this is also
not consistent across at least Ruby 1.8 and 1.9, where on 1.8 it is the
value nil, on 1.9 it works somewhat like a regular name.

To avoid all this confusion, this commit changes it to use a regular
name.
@dbussink
Copy link
Contributor Author

I've updated the pull request with the new name 'elem'

macfanatic added a commit that referenced this pull request Mar 5, 2013
Use normal variable name over _ when block variable is used
@macfanatic macfanatic merged commit 64caaa6 into activeadmin:master Mar 5, 2013
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.

3 participants