Undefined method `create_table' for #<LoginController:0x5e60

I am geeting the foolowing error.

undefined method `create_table’ for #LoginController:0x5e60110

I wrote the crete action in application controller.

I am coping ther total worng please help me!

class ApplicationController < ActionController::Base
model :cart
model :line_item
before_filter :authorize

def create

create_table() yields a TableDefinition instance

create_table(:suppliers) do |t|
t.column :name, :string, :limit => 60

Other fields here

end

end
def authorize
unless session[:user_id]
flash[:notice] = “Please log in”
redirect_to(:controller => “login”, :action => “login”)
end
end
private
def redirect_to_index(msg = nil)
flash[:notice] = msg if msg
redirect_to(:action => ‘index’)
end
end

with regards,

Naveen

On Wednesday 19 April 2006 15:00, Naveen wrote:

I am geeting the foolowing error.

undefined method `create_table’ for #LoginController:0x5e60110

(…snip…)

def create

create_table() yields a TableDefinition instance

create_table(:suppliers) do |t|
t.column :name, :string, :limit => 60

Other fields here

end

The method create_table isn’t a method of your model instances. It’s a
class
method. You can run it by saying:

ActiveRecord::Base.connection.create_table(params)

Wiebe C. wrote:

On Wednesday 19 April 2006 15:00, Naveen wrote:

I am geeting the foolowing error.

undefined method `create_table’ for #LoginController:0x5e60110

(…snip…)

def create

create_table() yields a TableDefinition instance

create_table(:suppliers) do |t|
t.column :name, :string, :limit => 60

Other fields here

end

The method create_table isn’t a method of your model instances. It’s a
class
method. You can run it by saying:

ActiveRecord::Base.connection.create_table(params)

Thanks for Reply!

Please guide me to learn ruby and rails .

from where can i start

bye for now

On Wednesday 19 April 2006 15:19, Naveen wrote:

Thanks for Reply!

Please guide me to learn ruby and rails .

from where can i start

bye for now

Alan has given a good start. Also, what he said about that you musn’t
create
tables in a controller is true. I didn’t give much thought to how you
were
using the call, but I don’t see why you want to create tables as part of
the
application’s functionality.

undefined method `create_table’ for #LoginController:0x5e60110

The create_table method is part of the ActiveRecord migrations system
and almost certainly shouldn’t be being called from a controller.

I’d suggest, Naveen, that you should stop typing, and do some reading.
You’re missing some fundamentals and are unlikely to pick them up from
isolated messages to this list.

Purchasing “Agile Web D. with Rails” would be a great start,
but if cost is a problem, there are several free tutorials online
covering the basics.

Hope this helps.

Alan

Wiebe C. wrote:

On Wednesday 19 April 2006 15:19, Naveen wrote:

Thanks for Reply!

Please guide me to learn ruby and rails .

from where can i start

bye for now

Alan has given a good start. Also, what he said about that you musn’t
create
tables in a controller is true. I didn’t give much thought to how you
were
using the call, but I don’t see why you want to create tables as part of
the
application’s functionality.

Where can I crete the tables, in other place how can we acees the
Actioncontroll

methods,

I am new ro RoR

Please help to use of functions of action controller,
Is there any function other than these

tell me the any sources to read more.

tell me the any sources to read more.

http://www.ruby-forum.com/topic/62687?reply_to=65793#65773