Skip to content

Instantly share code, notes, and snippets.

@devinmrn
devinmrn / tamperdata.log
Created September 2, 2011 22:17
TamperData from form.
15:13:13.371[1631ms][total 1631ms] Status: 200[OK]
POST http://tools.950buy.com/modules/2rss/2rss.php Load Flags[LOAD_BYPASS_CACHE LOAD_BACKGROUND ] Content Size[-1] Mime Type[text/html]
Request Headers:
Host[tools.950buy.com]
User-Agent[Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.1) Gecko/20100101 Firefox/6.0.1]
Accept[*/*]
Accept-Language[en-us,en;q=0.5]
Accept-Encoding[gzip, deflate]
Accept-Charset[ISO-8859-1,utf-8;q=0.7,*;q=0.7]
Connection[keep-alive]
@devinmrn
devinmrn / gist:1047127
Created June 26, 2011 01:29
Sort on fields from other column. Receive ActiveRecord::StatementInvalid
Error Log:
,,,ruby
2011-06-26T01:25:07+00:00 app[web.1]: Started GET "/admin/problems?sort=user_address&sort_reverse=false" for 76.114.20.226 at 2011-06-25 18:25:07 -0700
2011-06-26T01:25:07+00:00 app[web.1]:
2011-06-26T01:25:07+00:00 app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: syntax error at or near "{"
2011-06-26T01:25:07+00:00 app[web.1]: LINE 1: ...T "problems".* FROM "problems" ORDER BY problems.{User(id: ...
2011-06-26T01:25:07+00:00 app[web.1]: ^
2011-06-26T01:25:07+00:00 app[web.1]: : SELECT "problems".* FROM "problems" ORDER BY problems.{User(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, created_at: datetime, updated_at: datetime, first_name: string, last_name: string, location: string
@devinmrn
devinmrn / gist:1046177
Created June 25, 2011 05:14
devinmrn92 - Model delegation.
class User < ActiveRecord::Base
has_many :problems
attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :location, :address
attr_internal_accessor :user_address
def user_address
self.address
end
@devinmrn
devinmrn / gist:805443
Created February 1, 2011 05:04
Relations or separate columns ?
Consider the following scaffold for a virtual machine manager.
rails g scaffold virtualmachine total_memory:integer total_disk:integer
rails g scaffold plan title:string price_usd:integer max_memory:integer max_disk:integer
Now this is greatly simplified however I have around 30 values that I want to track for each virtual machine.
What would be the best way to do this?