lib/iord/resource_url.rb in iord-1.0.1 vs lib/iord/resource_url.rb in iord-1.0.2
- old
+ new
@@ -8,10 +8,11 @@
helper_method :has_collection?
helper_method :form_resource_url
helper_method :resource_url
helper_method :collection_url
+ helper_method :new_resource_url?
helper_method :new_resource_url
helper_method :edit_resource_url
end
def has_collection?
@@ -55,11 +56,17 @@
else
@collection_url ||= self.public_send collection_url_method
end
end
+ def new_resource_url_method
+ "new#{resource_url_method}".to_sym
+ end
+ def new_resource_url?
+ self.respond_to?(new_resource_url_method)
+ end
def new_resource_url
- @new_resource_url ||= self.public_send "new_#{resource_url_method}".to_sym
+ @new_resource_url ||= self.public_send(new_resource_url_method)
end
def edit_resource_url(resource = nil)
resource ||= @resource
resource = nil unless has_collection?