How do I display Ruby on Rails form validation error messages one at a time?

ActiveRecord stores validation errors in an array called errors. If you have a User model then you would access the validation errors in a given instance like so: @user = User.create[params[:user]] # create will automatically call validators if @user.errors.any? # If there are errors, do something # You can iterate through all messages by attribute … Read more

Ruby 1.9.2 and Rails 3 cannot open rails console

Apparently ubuntu and ruby don’t always catch dependencies like they should. From the first google hit (yeah, I clicked on this stack-overflow in place #2 before checking out the first result.) Navigate to the Ruby source and enter: sudo apt-get install libreadline5-dev cd ext/readline ruby extconf.rb make sudo make install So, if you’re on another … Read more

gem cannot access rubygems.org

api.rubygems.org is currently experiencing issues with IPv6 setup: this hostname has 4 IPv6 addresses, but responds on neither of them. Neither to ping, nor to TCP connection attempts. When you are running gem, your gem tries IPv6 addresses first and times out on them, not having time to even try IPv4 addresses. The solution is … Read more

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