Forum: Ruby on Rails undefined method `model' for ContactController:Class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D34b29c2f6525f877a99197ca2309c80?d=identicon&s=25 Sankar Kumar (sankarkumar)
on 2009-02-24 16:11
Hi ,

I'm getting "undefined method `model' for ContactController:Class"
Basically this is my first RoR application.
Can you please somebody help to resolve this.
Steps I have followed,
1)ruby script/generate model contact
2)ruby script/generate controller contact
3) vim app/controllers/contact_controller.rb
class ContactController < ApplicationController
  model :contact
  scaffold :contact
end
4)ruby script/server -p 9090

Actually I need to create/select/update table thru RoR.


Advance Thanks,
Sankar.
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-02-24 16:32
(Received via mailing list)
leave out the line
  model :contact
you don't need that.
D34b29c2f6525f877a99197ca2309c80?d=identicon&s=25 Sankar Kumar (sankarkumar)
on 2009-02-24 16:39
MaD wrote:
> leave out the line
>   model :contact
> you don't need that.

I have remove that .... Now I'm getting error like "undefined method
`scaffold' for ContactController:Class"

I think i'm totally wrong .... Can you pls let me know the step to
prepare small application ?
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-02-24 17:24
(Received via mailing list)
sorry i didn't read carefully enough.

try this:
  rails project
  cd project
  script/generate scaffold contact name:string street:string
mail:string
  nano config/database.yml
  rake db:migrate
  script/server
  firefox http://localhost:3000/contacts/new

hope this helps.

btw: the tutorial you are following seems outdated (pre rails 2.0)
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-02-24 17:33
(Received via mailing list)
On 24 Feb 2009, at 15:39, Sankar Kumar wrote:

> prepare small application ?
Sounds like you're trying to do an out of date tutorial. You will
probably save yourself some frustration by picking a more up to date
one.

Fred
D34b29c2f6525f877a99197ca2309c80?d=identicon&s=25 Sankar Kumar (sankarkumar)
on 2009-02-25 04:25
MaD wrote:
> sorry i didn't read carefully enough.
>
> try this:
>   rails project
>   cd project
>   script/generate scaffold contact name:string street:string
> mail:string
>   nano config/database.yml
>   rake db:migrate
>   script/server
>   firefox http://localhost:3000/contacts/new
>
> hope this helps.
>
> btw: the tutorial you are following seems outdated (pre rails 2.0)

Thanks a lot . Thank you so much ... Now I'm able to do
create/select/update table....
This topic is locked and can not be replied to.