Sha256: f1a4386c36e401718aa7127f8de8441055da23a1c6d62d1c164acf595e51c109

Contents?: true

Size: 514 Bytes

Versions: 4

Compression:

Stored size: 514 Bytes

Contents

# Patch for resource_controller to use collection_path with additional params.
# origin: RM
ResourceController::Helpers::Urls.module_eval do

  protected

  def collection_path_with_params(params = nil)
    collection_path_without_params.tap do |path|
      if params.present?
        path << (path.include?('?') ? '&' : '?')
        path << params.collect{ |key, value| "#{CGI::escape(key.to_s)}=#{CGI::escape(value.to_s)}" }.join('&')
      end
    end
  end

  alias_method_chain :collection_path, :params

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/config/initializers/collection_path_with_params.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/config/initializers/collection_path_with_params.rb
serum-rails-0.1.1 spec/test_app/config/initializers/collection_path_with_params.rb
serum-rails-0.1.0 spec/test_app/config/initializers/collection_path_with_params.rb