Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Use url_for as the default with form_for since rails does some magi…

…c to determine the url to use.
  • Loading branch information...
commit b3bf6f2f9635b49e677033c7d8bf4873f613b9da 1 parent 764f859
@binarylogic authored
View
1  CHANGELOG.rdoc
@@ -2,6 +2,7 @@
* Added a delete method to the Search class to allow the deleting of conditions off of the object.
* Add alias_scope feature, lets your create "named scopes" that represent a procedure of named scopes, while at the same time telling Searchlogic it is safe to use in the Search class.
+* Use url_for as the default with form_for since rails does some magic to determine the url to use.
== 2.0.1 released 2009-06-20
View
6 lib/searchlogic/rails_helpers.rb
@@ -6,6 +6,11 @@ module RailsHelpers
# By default Searchlogic gives you these named scopes for all of your columns, but
# if you wanted to create your own, it will work with those too.
#
+ # Examples:
+ #
+ # order @search, :by => :username
+ # order @search, :by => :created_at, :as => "Created"
+ #
# This helper accepts the following options:
#
# * <tt>:by</tt> - the name of the named scope. This helper will prepend this value with "ascend_by_" and "descend_by_"
@@ -42,6 +47,7 @@ def form_for(*args, &block)
options = args.extract_options!
options[:html] ||= {}
options[:html][:method] ||= :get
+ options[:url] ||= url_for
args.unshift(:search) if args.first == search_obj
args << options
end
View
5 spec/named_scopes/associations_spec.rb
@@ -1,11 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
describe "Associations" do
- before(:each) do
- @users_join_sql = ["INNER JOIN \"users\" ON users.company_id = companies.id"]
- @orders_join_sql = ["INNER JOIN \"users\" ON users.company_id = companies.id", "INNER JOIN \"orders\" ON orders.user_id = users.id"]
- end
-
it "should create a named scope" do
Company.users_username_like("bjohnson").proxy_options.should == User.username_like("bjohnson").proxy_options.merge(:joins => :users)
end
Please sign in to comment.
Something went wrong with that request. Please try again.