rails 3.1.0 ActionView::Template::Error (application.css isn’t precompiled)

By default Rails assumes that you have your files precompiled in the production environment, if you want use live compiling (compile your assets during runtime) in production you must set the config.assets.compile to true. # config/environments/production.rb … config.assets.compile = true … You can use this option to fallback to Sprockets when you are using precompiled … Read more

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I ran into a similar problem when trying to use the JQuery generator for Rails 3 I solved it like this: Get the CURL Certificate Authority (CA) bundle. You can do this with: sudo port install curl-ca-bundle [if you are using MacPorts] or just pull it down directly wget http://curl.haxx.se/ca/cacert.pem Execute the ruby code that … Read more

Run a single migration file

Assuming fairly recent version of Rails you can always run: rake db:migrate:up VERSION=20090408054532 Where version is the timestamp in the filename of the migration. Edit: At some point over the last 8 years (I’m not sure what version) Rails added checks that prevent this from running if it has already been run. This is indicated … Read more

how to permit an array with strong parameters

This https://github.com/rails/strong_parameters seems like the relevant section of the docs: The permitted scalar types are String, Symbol, NilClass, Numeric, TrueClass, FalseClass, Date, Time, DateTime, StringIO, IO, ActionDispatch::Http::UploadedFile and Rack::Test::UploadedFile. To declare that the value in params must be an array of permitted scalar values map the key to an empty array: params.permit(:id => []) In … Read more

Float vs Decimal in ActiveRecord

I remember my CompSci professor saying never to use floats for currency. The reason for that is how the IEEE specification defines floats in binary format. Basically, it stores sign, fraction and exponent to represent a Float. It’s like a scientific notation for binary (something like +1.43*10^2). Because of that, it is impossible to store … Read more

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