# "URL" model not possible?

**URL:** <https://www.ruby-forum.com/t/url-model-not-possible/129380>\
**Category:** Rails\
**Created:** [February 17, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/url-model-not-possible/129380 "2008-02-17T23:19:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joergbattermann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@joergbattermann](https://www.ruby-forum.com/u/joergbattermann)\
**Post date:** [February 17, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/url-model-not-possible/129380/1 "2008-02-17T23:19:38Z")

</div>

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:  
2:  
3: \<%= error\_messages\_for :url %\>  
4:  
5: \<% form\_for([@user, @url], :url =\> { :action =\> “create” }) do |f|  
%\>  
6:  
7:

Url  
  
8: \<%= f.text\_field :url %\>

:-/

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

-J

---

<div class="post-metadata">

**Author:** ![joergbattermann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@joergbattermann](https://www.ruby-forum.com/u/joergbattermann)\
**Post date:** [February 18, 2008, 2:54pm UTC](https://www.ruby-forum.com/t/url-model-not-possible/129380/2 "2008-02-18T14:54:23Z")

</div>

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.

On Feb 17, 10:19 pm, “Jörg Battermann” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![joergbattermann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@joergbattermann](https://www.ruby-forum.com/u/joergbattermann)\
**Post date:** [February 18, 2008, 9:49pm UTC](https://www.ruby-forum.com/t/url-model-not-possible/129380/3 "2008-02-18T21:49:44Z")

</div>

Thanks 🙂 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 🙂

---

<div class="post-metadata">

**Author:** ![joergbattermann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@joergbattermann](https://www.ruby-forum.com/u/joergbattermann)\
**Post date:** [February 18, 2008, 9:59pm UTC](https://www.ruby-forum.com/t/url-model-not-possible/129380/4 "2008-02-18T21:59:49Z")

</div>

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

Regards,  
Nicolai
