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: <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? -J --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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" <j...-0P9kJONFmSkxbLibK+HVikEOCMrvLtNR@public.gmane.org> wrote:> 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: <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? > > -J--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 :) On Feb 18, 2:53 pm, Wildtangent <wildtang...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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" <j...-0P9kJONFmSkxbLibK+HVikEOCMrvLtNR@public.gmane.org> > wrote: > > > 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: <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? > > > -J--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Such a list of reserved words is available here: http://wiki.rubyonrails.org/rails/pages/ReservedWords Regards, Nicolai --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Reasonably Related Threads
- restful_authentication: update of users' attributes on every page load upon 'Remember me' being enabled?
- ActionView::TemplateError (can't convert ActiveRecord::Error into String)
- How to test views with Nested Resources and Partials
- Odd error handling in ActionView#compile_template causes WSOD
- Why is this view spec failing?