aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/record_identifier.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate direct calls to AC::RecordIdentifier.dom_id and dom_classCarlos Antonio da Silva2013-01-161-5/+17
| | | | Also add some generic tests to ensure they're properly deprecated.
* Fix typo in deprecation warningNathaniel Jones2013-01-091-1/+1
|
* These are already required through AS/railsAkira Matsuda2013-01-061-1/+0
| | | | | | | * core_ext/object/blank * concern * core_ext/class/attribute * deprecation
* Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-301-2/+2
|
* Provide a call stack for deprecation warnings where needed.Nikita Afanasenko2012-10-291-2/+2
| | | | It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
* Deprecate AV::RecordIdentifier in controllersPiotr Sarnacki2012-08-281-3/+15
| | | | | | | | Methods provided by RecordIdentifier are not widely used in controllers nowadays as they're view specific (this is probably a legacy left after RJS rendering directly in controllers). However if people still need to use it, it's trivial to include ActionView::RecordIdentifier by themselves.
* Deprecate ActionController::RecordIdentifierPiotr Sarnacki2012-08-281-0/+8
|
* Move ActionController::RecordIdentifier to ActionViewPiotr Sarnacki2012-08-281-83/+0
| | | | | | | Since it's more about DOM classes and ids it belongs to Action View better. What's more, it's more convenient to make it part of Action View to follow the rule that Action Pack can depend on Action View, but not the other way round.
* Remove ActiveModel dependency from ActionPackGuillermo Iguaran2012-06-301-3/+5
| | | | | | | | ActiveModel is used in ActionPack for ActiveModel::Naming for a few, mostly optional aspects of ActionPack related to automatically converting an ActiveModel compliant object into a key for params and routing. It uses only three methods of ActiveModel (ActiveModel::Naming.route_key, ActiveModel::Naming.singular_route_key and ActiveModel::Naming.param_key).
* Removing ==Examples and last blank lines of docs from actionpackFrancesco Rodriguez2012-05-151-3/+3
|
* Removed the sanitize_dom_id method because HTML5 doctype let's us use ↵Larz Conwell2012-04-271-6/+1
| | | | anything except nothing and whitespace for id's
* Add AC record identifier example with not-persisted objectAlexey Vakhov2012-04-051-0/+1
|
* Remove Active Resource source files from the repositoryPrem Sichanugrist2012-03-131-2/+2
| | | | | | | | | | Dear Active Resource, It's not that I hate you or anything, but you didn't get much attention lately. There're so many alternatives out there, and I think people have made their choice to use them than you. I think it's time for you to have a big rest, peacefully in this Git repository. I will miss you, @sikachu.
* Update AC::RecordIdentifier exampleAlexey Vakhov2011-10-151-2/+2
|
* Nicolás Hock Isaza2011-09-061-1/+1
| | | | | Fixing `record_key_for_dom_id` documentation. The default implementation joins everything with '_' and not with '-'
* Added missing assert to test checking form with namespaced isolated model ↵Piotr Sarnacki2011-06-071-1/+1
| | | | and fixed helpers to work correctly in such case
* removes reference to RJS from AC::RecordIdentifier docsXavier Noria2011-04-131-10/+4
|
* No need to delegate. Simply include the whole RecordIdentifier module.José Valim2010-07-211-0/+2
|
* Moved a few methods from RecordIdentifier to ActiveModel::NamingPiotr Sarnacki2010-07-211-30/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Make polymorphic_url and scaffolding work with uncountable resources [#3930 ↵Andrew White2010-06-201-3/+11
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* revises some <%= in rdocXavier Noria2010-04-051-1/+1
|
* Update various documentation examples to use new routing DSLAndrew White2010-04-041-1/+1
|
* Fix dom_id for ActiveRecord [#4296 state:resolved]José Valim2010-03-301-2/+2
|
* AMo #key is now #to_key and CI is probably happysnusnu2010-02-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Obviously #key is a too common name to be included in the AMo interface, #to_key fits better and also relates nicely to #to_param. Thx wycats, koz and josevalim for the suggestion. AR's #to_key implementation now takes customized primary keys into account and there's a testcase for that too. The #to_param AMo lint makes no assumptions on how the method behaves in the presence of composite primary keys. It leaves the decision wether to provide a default, or to raise and thus signal to the user that implementing this method will need his special attention, up to the implementers. All AMo cares about is that #to_param is implemented and returns nil in case of a new_record?. The default CompliantObject used in lint_test provides a naive default implementation that just joins all key attributes with '-'. The #to_key default implementation in lint_test's CompliantObject now returns [id] instead of [1]. This was previously causing the (wrong) tests I added for AR's #to_key implementation to pass. The #to_key tests added with this patch should be better. The CI failure was caused by my lack of knowledge about the test:isolated task. The tests for the record_identifier code in action_controller are using fake non AR models and I forgot to stub the #to_key method over there. This issue didn't come up when running the test task, only test:isolated revealed it. This patch fixes that. All tests pass isolated or not, well, apart from one previously unpended test in action_controller that is unrelated to my patch.
* Adds #key and #to_param to the AMo interfacesnusnu2010-02-191-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit introduces two new methods that every AMo compliant object must implement. Below are the default implementations along with the implied interface contract. # Returns an Enumerable of all (primary) key # attributes or nil if new_record? is true def key new_record? ? nil : [1] end # Returns a string representing the object's key # suitable for use in URLs, or nil if new_record? # is true def to_param key ? key.first.to_s : nil end 1) The #key method Previously rails' record_identifier code, which is used in the #dom_id helper, relied on calling #id on the record to provide a reasonable DOM id. Now with rails3 being all ORM agnostic, it's not safe anymore to assume that every record ever will have an #id as its primary key attribute. Having a #key method available on every AMo object means that #dom_id can be implemented using record.to_model.key # instead of record.id Using this we're able to take composite primary keys into account (e.g. available in datamapper) by implementing #dom_id using a newly added record_key_for_dom_id(record) method. The user can overwrite this method to provide customized versions of the object's key used in #dom_id. Also, dealing with more complex keys that can contain arbitrary strings, means that we need to make sure that we only provide DOM ids that are valid according to the spec. For this reason, this patch sends the key provided through a newly added sanitize_dom_id(candidate_id) method, that makes sure we only produce valid HTML The reason to not just add #dom_id to the AMo interface was that it feels like providing a DOM id should not be a model concern. Adding #dom_id to the AMo interface would force these concern on the model, while it's better left to be implemented in a helper. Now one could say the same is true for #to_param, and actually I think that it doesn't really fit into the model either, but it's used in AR and it's a main part of integrating into the rails router. This is different from #dom_id which is only used in view helpers and can be implemented on top of a semantically more meaningful method like #key. 2) The #to_param method Since the rails router relies on #to_param to be present, AR::Base implements it and returns the id by default, allowing the user to overwrite the method if desired. Now with different ORMs integrating into rails, every ORM railtie needs to implement it's own #to_param implementation while already providing code to be AMo compliant. Since the whole point of AMo compliance seems to be to integrate any ORM seamlessly into rails, it seems fair that all we really need to do as another ORM, is to be AMo compliant. By including #to_param into the official interface, we can make sure that this code can be centralized in the various AMo compliance layers, and not be added separately by every ORM railtie. 3) All specs pass
* Clean up render @object a bit more.Yehuda Katz2009-08-071-15/+0
|
* Cherry-pick core extensionsJeremy Kemper2009-05-131-0/+2
|
* Reorganize ActionController folder structureJoshua Peek2009-01-271-1/+1
|
* Correct code example in dom_id docs. [#437 state:resolved]Andrew Kaspick2008-06-171-2/+2
|
* Move Class::ModelName to Active Support module core_extJeremy Kemper2008-06-061-18/+2
|
* Cache RecordIdentifier methods in Class#model_name wrapperJeremy Kemper2008-06-061-11/+34
|
* Make render shorthands work with namespaced controllersJacek Becela2008-05-101-4/+10
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Correct documentation for dom_id [jbarnette] Closes #10775Michael Koziarski2008-01-261-4/+4
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8734 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Resources: url_for([parent, child]) generates /parents/1/children/2 for the ↵Jeremy Kemper2007-06-051-1/+1
| | | | | | nested resource. Likewise with the other simply helpful methods like form_for and link_to. Closes #6432. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6951 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added record identifications to FormHelper#form_for and ↵David Heinemeier Hansson2007-05-141-1/+1
| | | | | | PrototypeHelper#remote_form_for [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6731 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Added the first part of Simply Helpful to core. The rest is pending a clean ↵David Heinemeier Hansson2007-04-301-0/+91
integartion of polymorphic urls [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6633 5ecf4fe2-1ee6-0310-87b1-e25e094e27de