params[:filter][:order] = "ascend_by_created_at"
@search = Note.search(params[:filter])
@notes = @search.all
Monday, September 13, 2010
Sorting searchlogic results
URL encoding
Reference: http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
ASCII Control characters | ||
Why: | These characters are not printable. | |
Characters: | Includes the ISO-8859-1 (ISO-Latin) character ranges 00-1F hex (0-31 decimal) and 7F (127 decimal.) |
Non-ASCII characters | ||
Why: | These are by definition not legal in URLs since they are not in the ASCII set. | |
Characters: | Includes the entire "top half" of the ISO-Latin set 80-FF hex (128-255 decimal.) |
"Reserved characters" | |||||||
Why: | URLs use some characters for special use in defining their syntax. When these characters are not used in their special role inside a URL, they need to be encoded. | ||||||
Characters: |
|
"Unsafe characters" | |||||||||||||||||||||||||
Why: | Some characters present the possibility of being misunderstood within URLs for various reasons. These characters should also always be encoded. | ||||||||||||||||||||||||
Characters: |
|
Functional test for respond_to :json in Rails
# Notes controller
def index
...
respond_to do |format|
format.json { render :json => @notes }
end
end
# Notes functional test
params = {:format => 'json', :title => ...}
get :index, params
notes = JSON.parse(@response.body)
assert_equal note.title, notes[0]['note']['title']
Subscribe to:
Posts (Atom)