Tuesday, May 16, 2006

'templates' is a reserved word in Rails

I'm glad I didn't spend too much time stabbing around in the dark on this one. I had a controller/model named 'templates', but there was a weird error that popped up:
undefined method `assign_variables_from_controller' for #
That's because 'templates' is a reserved word in Rails, so you can't use it for your controller name.

3 comments:

  1. moreover, you can not use @template variable in your controller

    ReplyDelete
  2. Thanks. Here are other reserved words:

    http://wiki.rubyonrails.org/rails/pages/ReservedWords

    ReplyDelete
  3. Anonymous12:21 PM

    I was getting this error due to the same problem:

    ActionView::Template::Error:
    can't convert ActionView::Resolver::Path into Integer

    ReplyDelete