On Nov 28, 1:49 pm, packat <[EMAIL PROTECTED]> wrote:
> My first Rails example using model and I got this NameError:
> NameError in VandaController#att
> uninitialized constant VandaController::Compute
>
Is the model in compute.rb in app/models or lib ?
Fred
> Same code works fine if I don't create the Compute object.
> What did I do wrong?
>
> Here is the Controller
> class VandaController < ApplicationController
> def att
> @compute = Compute.new
> @data1 = @compute.cmpt
> end
> end
>
> Here is the Model
> class Compute
> def cmpt
> return 5
> end
> end
>
> And here is the view
> <html>
> <head>
> <title>Model</title>
> </head>
> <body>
> <h1>reading data from a model</h1>
> <br>
> <br>
> Fetch : <%= @data1 %> from Compute model.
> <br>
> </body>
> </html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---