Reputation: 3195
i am just creating a simple new action in rails, but when i view it in browser i get this error :
undefined method `render' for #<Template:0x9e9993c>
the new method is :
def new
@template = Template.new
end
i have new.html.erb in the folder ! whats the problem ?
Upvotes: 8
Views: 5210
Reputation: 176562
The problem is that you are trying to assign a custom object to the @template
instance variable but @template
is an internal variable that should hold an instance of the Rails template for the current action.
Use a different variable name
def new
@tpl = Template.new
end
Upvotes: 13