Get NGINX to serve .gz compressed asset files

1) ensure you have Nginx > 1.2.x (to proper headers modifications) and compile with –with-http_gzip_static_module option 2) Enable this option gzip on (to serve back-end response with gzip header) 3) Setup assets location with gzip_static on (to serve all.css.gz, all.js.gz files directly) 4) Prevent of etag generation and last-modify calculation for assets 5) Turn on … Read more

Rails “is not a module” error

Ruby is telling you that it found an Insurance, but it is not a module. Perhaps you already have defined an Insurance class? Depending on the surrounding code it might help if you “reset” the namespace by prepending a double colon: broker = ::Insurance::Broker::FakeBroker.new(1234,1234)

Where is the documentation on url helpers in rails?

You can determine how many parameters a route helper requires by looking at the route definition. For example, you might have this routes file: resources :users If you ran rake routes at the command line you would see something like this: users GET /users(.:format) users#index POST /users(.:format) users#create new_user GET /users/new(.:format) users#new edit_user GET /users/:id/edit(.:format) … Read more

How can you do a conditional where clause using Active Record

It is possible to chain where statements residentials = Residential.where(:is_active => true) residentials = residentials.where(:other_thing => true) if param_was_passed This should work. Make sure this is not the last line in a function call; repeat the residentials variable as the last line in that case. (As per @digger69 comment)

UTF-8 characters mangled in HTTP Basic Auth username

I want to allow any valid UTF-8 characters in usernames and passwords. Abandon all hope. Basic Authentication and Unicode don’t mix. There is no standard(*) for how to encode non-ASCII characters into a Basic Authentication username:password token before base64ing it. Consequently every browser does something different: Opera uses UTF-8; IE uses the system’s default codepage … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)