NoMethodError (undefined method `length=' for #<Tour:0x000000081583f0>):

The error refers to book.rb but you refer to Book.rb. Is that just a typing error?

What happens if, in the Rails Console you do Book.first.length

I presume you have run the migration. Have you checked using a database tool that the column exists?

I wonder whether length is a reserved word. If all else fails try a different name.

Colin

Hey, thanks for the answer. As for the Book.rb - yes, it’s a typing error. When I run Book.first.length in the rails console, I get: 1.9.3-p327 :001 > Book.first.length Book Load (0.2ms) SELECT “books”.* FROM “books” WHERE “books”.“label” = 'app LIMIT 1 => nil And yes, I did run the migration. I think the problem can lie in Mongo collections. I’ve added the “length” collection by updating an already working Mongo Document. Maybe that’s the problem? I’ll try to set up another mongo document with the length collection only. class Guide::Document include MongoMapper::Document

key :city, Integer key :trips, Array key :themes, Array key :places, Array key :pace, String key :date_from, Time key :date_to, Time key :host, String key :length, Integer timestamps! end

W dniu czwartek, 28 marca 2013 16:52:13 UTC+1 użytkownik Colin Law napisał:

Why does that include a WHERE clause? and why is it looking for label = 'app

Colin

This is because we have a whitelabel feature in our app, and therefore most columns and tables are labelled to. The label “app” simply means that it loads all the data from our main app.

W dniu piątek, 29 marca 2013 11:48:56 UTC+1 użytkownik Colin Law napisał: