Class: ActiveRecordJsonUrlExtension::UrlHelper
- Inherits:
-
Object
- Object
- ActiveRecordJsonUrlExtension::UrlHelper
- Includes:
- ActionDispatch::Routing::UrlFor
- Defined in:
- app/models/active_record_json_url_extension.rb
Overview
The following class generates a scope that prevents the url helpers from being included directly into ActiveRecordJsonUrlExtension and therefore into ActiveRecord::Base.
class MyModel < ActiveRecord::Base
end
my_instance = MyModel.create()
You may call my_instance.url()
to get the same result as for url_for(my_instance)
. But you should not be able to call, for example, my_instance.my_model_path( ... )
.
Instance Method Summary collapse
-
#initialize(obj) ⇒ UrlHelper
constructor
A new instance of UrlHelper.
- #url ⇒ Object
- #url_options ⇒ Object
Constructor Details
#initialize(obj) ⇒ UrlHelper
Returns a new instance of UrlHelper.
35 36 37 |
# File 'app/models/active_record_json_url_extension.rb', line 35 def initialize( obj ) @obj = obj end |
Instance Method Details
#url ⇒ Object
43 44 45 |
# File 'app/models/active_record_json_url_extension.rb', line 43 def url url_for @obj end |
#url_options ⇒ Object
39 40 41 |
# File 'app/models/active_record_json_url_extension.rb', line 39 def Rails.application.config.action_mailer. end |