Re: [Rails] ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect datetime value:
HI Vivek, I got these new errors: 1) Error: UserMailerTest#test_account_activation: NoMethodError: undefined method `toLocaleFormat' for Fri, 19 Dec 2014 21:44:44 UTC +00:00:Time 2) Error: UserMailerTest#test_password_reset: NoMethodError: undefined method `toLocaleFormat' for Fri, 19 Dec 2014 21:44:44 UTC +00:00:Time On Thu, Dec 18, 2014 at 9:27 PM, Vivek Sampara wrote: > > Try toLocaleFormat() > > On Fri, Dec 19, 2014 at 6:24 AM, Michael Sutyak wrote: > >> am running a test with mailers within Ruby on Rails, and I am getting the >> following errors: >> >> *-C02MGBVJFD57:myapp $ bundle exec rake test:mailers >> # Running: >> >> EE >> Finished in 0.110500s, 18.0995 runs/s, 0. assertions/s. >> >> 1) >> Error:UserMailerTest#test_account_activation:ActiveRecord::StatementInvalid: >> Mysql2::Error: Incorrect datetime value: '2014-12-18 01:07:49 UTC' for >> column 'activated_at' at row 1: INSERT INTO `users` (`name`, `email`, >> `password_digest`, `admin`, `activated`, `activated_at`, `created_at`, >> `updated_at`, `id`) VALUES ('Michael Example', 'mich...@example.com', >> '$2a$04$hz6pvZctid6gZEuv0.qAe.0mEfbEjxso9GrXwC3yHRhIThIJ7Vx5m', 1, 1, >> '2014-12-18 01:07:49 UTC', '2014-12-18 01:07:49', '2014-12-18 01:07:49', >> 762146111) >> >> >> >> 2) >> Error:UserMailerTest#test_password_reset:ActiveRecord::StatementInvalid: >> Mysql2::Error: Incorrect datetime value: '2014-12-18 01:07:49 UTC' for >> column 'activated_at' at row 1: INSERT INTO `users` (`name`, `email`, >> `password_digest`, `admin`, `activated`, `activated_at`, `created_at`, >> `updated_at`, `id`) VALUES ('Michael Example', 'mich...@example.com', >> '$2a$04$XTAWn5P9kikgOXqxQgiJqOjP027p4HnucHZ6pth2aaLwolaFcehsm', 1, 1, >> '2014-12-18 01:07:49 UTC', '2014-12-18 01:07:49', '2014-12-18 01:07:49', >> 762146111) >> >> 2 runs, 0 assertions, 0 failures, 2 errors, 0 skips >> >> When I check my fixtures users.yml file, I see that I am using the time >> zone ruby stamp: >> >> michael: >> name: Michael Example >> email: mich...@example.com >> password_digest: <%= User.digest('password') %> >> admin: true >> activated: true >> activated_at: <%= Time.zone.now %> >> >> archer: >> name: Sterling Archer >> email: duch...@example.gov >> password_digest: <%= User.digest('password') %> >> activated: true >> activated_at: <%= Time.zone.now %> >> >> lana: >> name: Lana Kane >> email: ha...@example.gov >> password_digest: <%= User.digest('password') %> >> activated: true >> activated_at: <%= Time.zone.now %> >> >> mallory: >> name: Mallory Archer >> email: b...@example.gov >> password_digest: <%= User.digest('password') %> >> activated: true >> activated_at: <%= Time.zone.now %> >> <% 30.times do |n| %> >> user_<%= n %>: >> name: <%= "User #{n}" %> >> email: <%= "user-#{n}@example.com" %> >> password_digest: <%= User.digest('password') %> >> activated: true >> activated_at: <%= Time.zone.now %><% end %> >> >> and my db/seeds.rb file looks like so: >> >> User.create!(name: "Example User", >> email: "exam...@railstutorial.org", >> password: "foobar", >> password_confirmation: "foobar", >> admin: true, >> activated: true, >> activated_at: Time.zone.now) >> 99.times do |n| >> name = Faker::Name.name >> email = "example-#{n+1}@railstutorial.org" >> password = "password" >> User.create!(name: name, >>email: email, >>password: password, >>password_confirmation: password, >>activated: true, >>activated_at: Time.zone.now)end >> >> So I should be using the right time form. >> >> Here is the test itself: >> >> user_mailer_test.rb: >> >> require 'test_helper' >> >> class UserMailerTest < ActionMailer::TestCase >> >> test "account_activation" do >>
[Rails] ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect datetime value:
am running a test with mailers within Ruby on Rails, and I am getting the following errors: *-C02MGBVJFD57:myapp $ bundle exec rake test:mailers # Running: EE Finished in 0.110500s, 18.0995 runs/s, 0. assertions/s. 1) Error:UserMailerTest#test_account_activation:ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect datetime value: '2014-12-18 01:07:49 UTC' for column 'activated_at' at row 1: INSERT INTO `users` (`name`, `email`, `password_digest`, `admin`, `activated`, `activated_at`, `created_at`, `updated_at`, `id`) VALUES ('Michael Example', 'mich...@example.com', '$2a$04$hz6pvZctid6gZEuv0.qAe.0mEfbEjxso9GrXwC3yHRhIThIJ7Vx5m', 1, 1, '2014-12-18 01:07:49 UTC', '2014-12-18 01:07:49', '2014-12-18 01:07:49', 762146111) 2) Error:UserMailerTest#test_password_reset:ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect datetime value: '2014-12-18 01:07:49 UTC' for column 'activated_at' at row 1: INSERT INTO `users` (`name`, `email`, `password_digest`, `admin`, `activated`, `activated_at`, `created_at`, `updated_at`, `id`) VALUES ('Michael Example', 'mich...@example.com', '$2a$04$XTAWn5P9kikgOXqxQgiJqOjP027p4HnucHZ6pth2aaLwolaFcehsm', 1, 1, '2014-12-18 01:07:49 UTC', '2014-12-18 01:07:49', '2014-12-18 01:07:49', 762146111) 2 runs, 0 assertions, 0 failures, 2 errors, 0 skips When I check my fixtures users.yml file, I see that I am using the time zone ruby stamp: michael: name: Michael Example email: mich...@example.com password_digest: <%= User.digest('password') %> admin: true activated: true activated_at: <%= Time.zone.now %> archer: name: Sterling Archer email: duch...@example.gov password_digest: <%= User.digest('password') %> activated: true activated_at: <%= Time.zone.now %> lana: name: Lana Kane email: ha...@example.gov password_digest: <%= User.digest('password') %> activated: true activated_at: <%= Time.zone.now %> mallory: name: Mallory Archer email: b...@example.gov password_digest: <%= User.digest('password') %> activated: true activated_at: <%= Time.zone.now %> <% 30.times do |n| %> user_<%= n %>: name: <%= "User #{n}" %> email: <%= "user-#{n}@example.com" %> password_digest: <%= User.digest('password') %> activated: true activated_at: <%= Time.zone.now %><% end %> and my db/seeds.rb file looks like so: User.create!(name: "Example User", email: "exam...@railstutorial.org", password: "foobar", password_confirmation: "foobar", admin: true, activated: true, activated_at: Time.zone.now) 99.times do |n| name = Faker::Name.name email = "example-#{n+1}@railstutorial.org" password = "password" User.create!(name: name, email: email, password: password, password_confirmation: password, activated: true, activated_at: Time.zone.now)end So I should be using the right time form. Here is the test itself: user_mailer_test.rb: require 'test_helper' class UserMailerTest < ActionMailer::TestCase test "account_activation" do mail = UserMailer.account_activation assert_equal "Account activation", mail.subject assert_equal ["t...@example.org"], mail.to assert_equal ["f...@example.com"], mail.from assert_match "Hi", mail.body.encoded end test "password_reset" do mail = UserMailer.password_reset assert_equal "Password reset", mail.subject assert_equal ["t...@example.org"], mail.to assert_equal ["f...@example.com"], mail.from assert_match "Hi", mail.body.encoded end end Is there something I am doing wrong? Thank you for your help. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7c779d06-608c-46ac-ad27-15bda1365bf1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] Error after calling bundle install (Ruby on Rails installation) (Mac OS X)
I'm pretty sure I installed everything required. What could be missing on Mac OS X? On Wednesday, August 6, 2014 12:01:53 AM UTC-7, Colin Law wrote: > > On 5 August 2014 23:53, Michael Sutyak > > wrote: > > I am trying to initialize a rails application, and I am running into > some > > issues. When running: rails new . -m > > https://raw.github.com/RailsApps/rails-composer/master/composer.rb > > > > I run into the issue: > > > > Could not find gem 'quiet_assets (>= 0) ruby' in the gems available on > this > > machine. > > Run `bundle install` to install missing gems. > > > > When I try to run bundle install, it gives me this error: > > > > An error occurred while installing mysql2 (0.3.16), and Bundler cannot > > continue. > > Make sure that `gem install mysql2 -v '0.3.16'` succeeds before > bundling. > > > > When I run that command, I get: > > > > ERROR: Error installing mysql2: > > ERROR: Failed to build gem native extension. > > You probably have not installed everything that is necessary for > building gem native extensions. What you need depends on which OS you > are using. For example, on Ubuntu, I do > > sudo apt-get install build-essential bison openssl libreadline6 > libreadline6-dev curl git-core \ > zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf > libc6-dev ncurses-dev automake \ > libtool > > Colin > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6e6a0787-e408-4e9e-b86e-a6eefd7f799d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Error after calling bundle install (Ruby on Rails installation) (Mac OS X)
I am trying to initialize a rails application, and I am running into some issues. When running: rails new . -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb I run into the issue: Could not find gem 'quiet_assets (>= 0) ruby' in the gems available on this machine.Run `bundle install` to install missing gems. When I try to run bundle install, it gives me this error: An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling. When I run that command, I get: ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. Running sudo apt-get install mysql-server sudo apt-get install mysql-client I get the error: apt-get: command not found Any ideas? I have full output below (from where the problems start, where composer tries to install the bundle of gems): composer Installing gems. This will take a while. runbundle install --without production from "."Fetching gem metadata from https://rubygems.org/Fetching additional metadata from https://rubygems.org/..Resolving dependencies...Using rake 10.3.2Using i18n 0.6.11Using json 1.8.1Using minitest 5.4.0Using thread_safe 0.3.4Using tzinfo 1.2.1Using activesupport 4.1.4Using builder 3.2.2Using erubis 2.7.0Using actionview 4.1.4Using rack 1.5.2Using rack-test 0.6.2Using actionpack 4.1.4Using mime-types 1.25.1Using polyglot 0.3.5Using treetop 1.4.15Using mail 2.5.4Using actionmailer 4.1.4Using activemodel 4.1.4Using arel 5.0.1.20140414130214Using activerecord 4.1.4Using addressable 2.3.6Using bcrypt 3.1.7Using coderay 1.1.0Using better_errors 1.1.0Using debug_inspector 0.0.2Using binding_of_caller 0.7.2Using sass 3.2.19Using bootstrap-sass 3.2.0.1Using bundler 1.6.2Using colorize 0.7.3Using net-ssh 2.9.1Using net-scp 1.2.1Using sshkit 1.5.1Using capistrano 3.0.1Using capistrano-bundler 1.1.2Using capistrano-rails 1.1.0Using capistrano-rails-console 0.2.0Using capistrano-rvm 0.1.1Using mini_portile 0.6.0Using nokogiri 1.6.3.1Using xpath 2.0.0Using capybara 2.4.1Using timers 1.1.0Using celluloid 0.15.2Using ffi 1.9.3Using childprocess 0.5.3Using coffee-script-source 1.7.1Using execjs 2.2.1Using coffee-script 2.3.0Using thor 0.19.1Using railties 4.1.4Using coffee-rails 4.0.1Using database_cleaner 1.3.0Using orm_adapter 0.5.0Using warden 1.2.3Using devise 3.2.4Using diff-lcs 1.2.5Using factory_girl 4.4.0Using factory_girl_rails 4.4.1Using faker 1.4.2Using hike 1.2.3Using multi_json 1.10.1Using tilt 1.4.1Using sprockets 2.11.0Using sprockets-rails 2.1.3Using rails 4.1.4Using figaro 1.0.0.rc1Using formatador 0.2.5Using rb-fsevent 0.9.4Using rb-inotify 0.9.5Using listen 2.7.9Using lumberjack 1.0.9Using method_source 0.8.2Using slop 3.6.0Using pry 0.10.0Using guard 2.6.1Using guard-bundler 2.0.0Using guard-rails 0.5.3Using rspec-support 3.0.3Using rspec-core 3.0.3Using rspec-expectations 3.0.3Using rspec-mocks 3.0.3Using rspec 3.0.0Using guard-rspec 4.3.1Using haml 4.1.0.beta.1Using sexp_processor 4.4.3Using ruby_parser 3.1.3Using haml2slim 0.4.7Using high_voltage 2.2.1Using hpricot 0.8.6Using html2haml 1.0.1Using hub 1.12.2Using interception 0.5Using jbuilder 2.1.3Using jquery-rails 3.1.1Using launchy 2.4.2 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /Users/**/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no*** extconf.rb failed ***Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/*/.rvm/rubies/ruby-2.1.2/bin/ruby --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-my