I generated scaffolding for User with the following schema:
  create_table "users", :force => true do |t|
    t.string   "name"
    t.string   "company"
    t.string   "lastcompany"
    t.datetime "changed"
    t.datetime "created_at"
    t.datetime "updated_at"
  end
When I run the automatically generated functional tests against the
Users controller, I get one failure:
  test_should_update_user(UsersControllerTest):
  NoMethodError: undefined method `|’ for Wed Apr 29 23:49:18 UTC
2009:Time
Oddly, if I just run this one test it passes:
  >ruby functional\users_controller_test.rb -n test_should_update_user
  Loaded suite functional/users_controller_test
  Started
.
  Finished in 0.594 seconds.
  1 tests, 1 assertions, 0 failures, 0 errors
The failure seems to be on this line of my controller:
      if @user.update_attributes(params[:user])
Because if I change it to "if true" my test passes.
The only thing unique about this particular class is that it has an
additional datetime member.  I''m not having luck with google searches
because of that pipe character.  Hopefully I''m running into a fairly
common failure here?
Brian wrote: That error is saying that at some point in your code there is a statement that evaluates to this: (Wed Apr 29 23:49:18 UTC 2009:Time) | <something else here> -- Posted via http://www.ruby-forum.com/.
On May 10, 4:56 am, Brian <butler.bria...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I generated scaffolding for User with the following schema: > > create_table "users", :force => true do |t| > t.string "name" > t.string "company" > t.string "lastcompany" > t.datetime "changed"your changed column is squashing an activerecord method called changed, rails calls the changed method expecting to get it''s changed method, but gets the accessor for your column instead. Fred> t.datetime "created_at" > t.datetime "updated_at" > end > > When I run the automatically generated functional tests against the > Users controller, I get one failure: > > test_should_update_user(UsersControllerTest): > NoMethodError: undefined method `|’ for Wed Apr 29 23:49:18 UTC > 2009:Time > > Oddly, if I just run this one test it passes: > > >ruby functional\users_controller_test.rb -n test_should_update_user > Loaded suite functional/users_controller_test > Started > . > Finished in 0.594 seconds. > > 1 tests, 1 assertions, 0 failures, 0 errors > > The failure seems to be on this line of my controller: > > if @user.update_attributes(params[:user]) > > Because if I change it to "if true" my test passes. > > The only thing unique about this particular class is that it has an > additional datetime member. I''m not having luck with google searches > because of that pipe character. Hopefully I''m running into a fairly > common failure here?
That was it. It took me a while to confirm because I (stupidly) wrote a migration to replace "change" (notice the missing "d") with "lastchanged". The good part is that it forced me to install ruby- debug to take a closer look, and I was able to see the problem for myself. Thanks for the help! On May 10, 1:10 pm, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On May 10, 4:56 am, Brian <butler.bria...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I generated scaffolding for User with the following schema: > > > create_table "users", :force => true do |t| > > t.string "name" > > t.string "company" > > t.string "lastcompany" > > t.datetime "changed" > > your changed column is squashing an activerecord method called > changed, rails calls the changed method expecting to get it''s changed > method, but gets the accessor for your column instead. > > Fred > > > > > t.datetime "created_at" > > t.datetime "updated_at" > > end > > > When I run the automatically generated functional tests against the > > Users controller, I get one failure: > > > test_should_update_user(UsersControllerTest): > > NoMethodError: undefined method `|’ for Wed Apr 29 23:49:18 UTC > > 2009:Time > > > Oddly, if I just run this one test it passes: > > > >ruby functional\users_controller_test.rb -n test_should_update_user > > Loaded suite functional/users_controller_test > > Started > > . > > Finished in 0.594 seconds. > > > 1 tests, 1 assertions, 0 failures, 0 errors > > > The failure seems to be on this line of my controller: > > > if @user.update_attributes(params[:user]) > > > Because if I change it to "if true" my test passes. > > > The only thing unique about this particular class is that it has an > > additional datetime member. I''m not having luck with google searches > > because of that pipe character. Hopefully I''m running into a fairly > > common failure here?- Hide quoted text - > > - Show quoted text -