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

Override devise registrations controller

In your form are you passing in any other attributes, via mass assignment that don’t belong to your user model, or any of the nested models? If so, I believe the ActiveRecord::UnknownAttributeError is triggered in this instance. Otherwise, I think you can just create your own controller, by generating something like this: # app/controllers/registrations_controller.rb class … Read more

Ignoring time zones altogether in Rails and PostgreSQL

Postgres has two different timestamp data types: timestamp with time zone, short name: timestamptz timestamp without time zone, short name: timestamp timestamptz is the preferred type in the date/time family, literally. It has typispreferred set in pg_type, which can be relevant: Generating time series between two dates in PostgreSQL Internal storage and epoch Internally, timestamps … Read more

Convert string to XXX

What you need is hash and not string. You can use it like this, hash = {id: 2} User.where(hash) And if you really want to use string you can do it like this, string = “id = 2” User.where(string) If you want to execute the string you can use eval. In that case it will … Read more

Randomly output text from array to view – RAILS [closed]

It is not really well formated question … You should be more precise about what you want, what you are using, etc. Assuming you are using Rails 3, ERB for HTML generation: # in your controller: file_as_array = IO.readlines(‘filename.txt’) random_line = rand(file_as_array.size) @my_random_string = file_as_array[random_line] # in your view: <%= @my_random_string %>