method
prefix=
v2.3.8 -
Show latest stable
- Class:
ActiveResource::Base
prefix=(value = '/')public
Sets the \prefix for a resource’s nested URL (e.g., prefix/collectionname/1.xml). Default value is site.path.
# File activeresource/lib/active_resource/base.rb, line 429
def prefix=(value = '/')
# Replace :placeholders with '#{embedded options[:lookups]}'
prefix_call = value.gsub(/:\w+/) { |key| "\#{options[#{key}]}" }
# Clear prefix parameters in case they have been cached
@prefix_parameters = nil
# Redefine the new methods.
code, line = "def prefix_source() \"\#{value}\" end\ndef prefix(options={}) \"\#{prefix_call}\" end\n", __LINE__ + 1
silence_warnings { instance_eval code, __FILE__, line }
rescue
logger.error "Couldn't set prefix: #{$!}\n #{code}"
raise
end Related methods
- Instance methods
- ==
- as_json
- clone
- destroy
- dup
- encode
- eql?
- exists?
- hash
- id
- id=
- load
- new?
- new_record?
- reload
- respond_to?
- save
- to_param
- to_xml
- Class methods
- collection_path
- connection
- create
- delete
- element_path
- exists?
- find
- format
- format=
- headers
- new
- password
- password=
- prefix
- prefix=
- prefix_source
- proxy
- proxy=
- site
- site=
- ssl_options
- ssl_options=
- timeout
- timeout=
- user
- user=
- Protected methods
-
collection_path -
connection -
create -
element_path -
id_from_response -
load_attributes_from_response -
update - Private methods
-
create_proxy_uri_from -
create_site_uri_from -
find_every -
find_one -
find_single -
instantiate_collection -
instantiate_record -
prefix_parameters -
query_string -
split_options -
find_or_create_resource_for -
find_or_create_resource_for_collection -
find_resource_in_modules -
method_missing -
split_options