"URL" model not possible?

Hello there,

I just added an URL model to my app (allowing users to basically add
urls etc), which works perfectly fine on the console, but the views
are not working properly. I always get the following error (e.g. when
wanting to create/add a new url):

ActionView::TemplateError (undefined method `rewrite' for #<Url:
0x25a6070>) on line #5 of urls/new.html.erb:
3: <%= error_messages_for :url %>
5: <% form_for([@user, @url], :url => { :action => "create" }) do |f|
7: <p><label for=":url">Url</label><br/>
8: <%= f.text_field :url %></p>


Is an URL model not possible at all or am I missing something?


I think Url will already be an object, so you've overridden an
existing object, meaning it doesn't have the same structure any more,
hence the ActionView error.
There are a few gotchas like that when naming your controllers and
models. Try a different name.

Thanks :slight_smile: Yeah - I did. Might be nice to have an overview/cheatsheet
somewhere which names are sort of reserved or not usable by rails
(e.g. ran into the trouble naming another one 'Set' - which doesn't
work either).

But oh well... thanks for the answer,
-J :slight_smile:

Such a list of reserved words is available here: http://wiki.rubyonrails.org/rails/pages/ReservedWords