Re: [Rails] Re: has_many relation - NoMethodError

2012-08-25 Thread tappind
And tadda... for me it was reloading the console. I updated the relations but didn't reload the console... D'oh! On Saturday, August 25, 2012 10:44:22 PM UTC-6, tappind wrote: > > In the same boat here. Did you ever resolve this? > > Dan > > On Thursday, February 24, 2011 6:47:39 AM UTC-7, Mich

Re: [Rails] Re: has_many relation - NoMethodError

2012-08-25 Thread tappind
In the same boat here. Did you ever resolve this? Dan On Thursday, February 24, 2011 6:47:39 AM UTC-7, Michael Pavling wrote: > > > On 21 Feb., 11:31, Jim Ruther Nill wrote: > >> could you confirm if the error still exists if you drop your db and > >> remigrate? > >> > On 24 February 2011 13:31

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-24 Thread Michael Pavling
> On 21 Feb., 11:31, Jim Ruther Nill wrote: >> could you confirm if the error still exists if you drop your db and >> remigrate? >> On 24 February 2011 13:31, rogi wrote: > How can I drop and remigrate? one alternative: rake db:migrate VERSION=0 rake db:migrate -- You received this messag

[Rails] Re: has_many relation - NoMethodError

2011-02-24 Thread rogi
I tried following tutorial http://biodegradablegeek.com/2007/12/understanding-basic-database-relationships-in-rails/ and also got the problem again: irb(main):019:0> tune.genre = Genre.find_by_name('Blues Rock') NoMethodError: undefined method `genre=' for # So maybe i have a general problem .

[Rails] Re: has_many relation - NoMethodError

2011-02-24 Thread rogi
How can I drop and remigrate? On 21 Feb., 11:31, Jim Ruther Nill wrote: > could you confirm if the error still exists if you drop your db and > remigrate? > > > > > > > > > > On Mon, Feb 21, 2011 at 5:30 PM, rogi wrote: > > class Worker < ActiveRecord::Base > >        has_many :trainings > >  

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-21 Thread Michael Pavling
On 21 February 2011 10:50, Colin Law wrote: > This really makes no sense to me. +1 Everything looks good... nothing is jumping out at me - but the error messages you're getting don't tie with what code/migrations you have. > Have a look and remove anything extra there.  Are > you *absolutely* su

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-21 Thread Colin Law
On 21 February 2011 09:30, rogi wrote: > class Worker < ActiveRecord::Base >        has_many :trainings >        has_many :courses, :through => :trainings >        belongs_to :ressort > >        def firstname_and_name >        first_name+" "+last_name >        end > end > > --- > class Ressort < A

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-21 Thread Jim Ruther Nill
could you confirm if the error still exists if you drop your db and remigrate? On Mon, Feb 21, 2011 at 5:30 PM, rogi wrote: > class Worker < ActiveRecord::Base >has_many :trainings >has_many :courses, :through => :trainings >belongs_to :ressort > >def firstname_an

[Rails] Re: has_many relation - NoMethodError

2011-02-21 Thread rogi
class Worker < ActiveRecord::Base has_many :trainings has_many :courses, :through => :trainings belongs_to :ressort def firstname_and_name first_name+" "+last_name end end --- class Ressort < ActiveRecord::Base has_many :workers end --- c

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread Colin Law
On 20 February 2011 16:59, rogi wrote: > irb(main):038:0> Ressort.find(1).workers > NoMethodError: undefined method `workers' for # > > irb(main):039:0> Worker.first.ressort > ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: > ressorts.worker_id: SELECT  "ressorts".* FROM "re

[Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread rogi
irb(main):038:0> Ressort.find(1).workers NoMethodError: undefined method `workers' for # irb(main):039:0> Worker.first.ressort ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: ressorts.worker_id: SELECT "ressorts".* FROM "re ssorts" WHERE ("ressorts".worker_id = 1) LIMIT 1

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread Michael Pavling
On 20 February 2011 13:23, rogi wrote: > No: > > ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: > ressorts.worker_id: SELECT  "ressorts".* FROM "ressorts" WHERE > ("ressorts".worker_id = 1) LIMIT 1 What command did you type to get this return value? It's certainly weird if

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread Jim Ruther Nill
This is weird. Could you paste your migration files and schema. Also, did you override the find method for Worker class? On Sun, Feb 20, 2011 at 9:23 PM, rogi wrote: > No: > > ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: > ressorts.worker_id: SELECT "ressorts".* FROM

[Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread rogi
No: ActiveRecord::StatementInvalid: SQLite3::SQLException: no such column: ressorts.worker_id: SELECT "ressorts".* FROM "ressorts" WHERE ("ressorts".worker_id = 1) LIMIT 1 irb(main):037:0> Ressort => Ressort(id: integer, name: string, description: text, created_at: datetime, updated_at: datetime

Re: [Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread Michael Pavling
On 20 February 2011 12:47, rogi wrote: > Nothing, I only had the typo here. > So, still facing the problem! Does it work the other way around? can you call "Worker.first.ressort"? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post

[Rails] Re: has_many relation - NoMethodError

2011-02-20 Thread rogi
Nothing, I only had the typo here. So, still facing the problem! class Ressort < ActiveRecord::Base has_many :workers end On Feb 20, 1:40 pm, Michael Pavling wrote: > On 20 February 2011 12:33, rogi wrote: > > > Ressort > >  has_many: workers > > typo: >   has_many :workers > > ...move