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

Unquoted query generated by through-association scope #1361

Closed
wants to merge 1,218 commits into from

Conversation

mrcljx
Copy link

@mrcljx mrcljx commented May 27, 2011

Through-association owner's primary key wasn't quoted. This generates invalid SQL if the record wasn't saved yet (i.e. the primary key's value is nil) and you try to access the relation (should return an empty result).

Real-world example of generated sql:

SELECT `tags`.*
  FROM `tags`
  INNER JOIN `taggings` ON `tags`.id = `taggings`.tag_id
  WHERE
    ((`taggings`.taggable_id = ) AND (`taggings`.taggable_type = 'Ticket'))
    AND (taggings.context = 'tags' AND taggings.tagger_id IS NULL)

jamis and others added 30 commits January 19, 2011 10:31
this prevents test state from accumulating, resulting in leaked
objects and slow tests due to overactive GC.
this can provide a significant performance boost during testing, by
preventing the GC from running too frequently.
Signed-off-by: José Valim <jose.valim@gmail.com>
…e' into 3-0-stable

* jonleighton/deprecate_habtm_attributes-3-0-stable:
  Added deprecation warning for has_and_belongs_to_many associations where the join table has additional attributes other than the keys. Access to these attributes is removed in 3.1. Please use has_many :through instead.
… inadvertently causing javascript errors.

This fixes CVE-2011-0446
Unfortunately the previous method of browser detection and XHR whitelisting is unable to prevent requests issued from some Flash animations and Java applets.  To ease the work required to include the CSRF token in ajax requests rails now supports providing the token in a custom http header:

 X-CSRF-Token: ...

This fixes CVE-2011-0447
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
rails#6353 state:resolved]

This handles the case where config.cache_classes is true and classes
are loaded before the I18n load path has had a chance to be populated.

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
…rails#6353 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
To make sure it will show block contents if it is placed after 'render
:partial'

[rails#5557 state:resolved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
…ing to a BigDecimal.

[rails#6365 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
…ved]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
tenderlove and others added 26 commits May 24, 2011 11:27
…thod 'prerequisites' for nil:NilClass (from rspec)
This fixes rake for me in RefineryCMS.
…lid SQL (id = ) if the record wasn't saved yet (i.e. the primary key's value is nil).
@josevalim
Copy link
Contributor

It seems something is wrong with your pull request. :P

@josevalim josevalim closed this May 27, 2011
@mrcljx
Copy link
Author

mrcljx commented May 27, 2011

Whoops. Github exploded. Fixed the Pull-Request (now 1362). Sorry for the mess.

jake3030 pushed a commit to jake3030/rails that referenced this pull request Jun 28, 2011
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