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 ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With