Hey guys, Here''s an error I get after I hit the submit button on the editing page: NameError in ClassifiedsController#update uninitialized constant ClassifiedsController Help would be appreciated. Thanks -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sep 28, 6:02 am, Faisal Basha <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hey guys, > > Here''s an error I get after I hit the submit button on the editing > page: > > NameError in ClassifiedsController#update > > uninitialized constant ClassifiedsController >Does that controller exist (and in the right place) ? Fred> Help would be appreciated. > > Thanks > -- > Posted viahttp://www.ruby-forum.com/.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
hi, Yes the below code is what I have i.e update method in
Classifieds_controller.rb....
def edit
@classifed = Classified.find(params[:id])
end
def update
@classifed = Classified.find(params[:id])
if @classified.update_attributes(params[:classified])
flash[:notice] = "updated"
redirect_to @classified
else
render :action => ''edit''
end
end
Edit.rhtml
<h1>Editing Classified: <%= :title -%></h1>
<% form_for @classified do |form| %>
<%=form.error_messages%>
<p>
<%=form.label :title%><br/>
<%= form.text_field :title %>
</p>
<p>
<%=form.label :price%><br/>
<%= form.text_field :price %>
</p>
<p>
<%=form.label :location%><br/>
<%= form.text_field :location %>
</p>
<p>
<%=form.label :description%><br/>
<%= form.text_area :description %>
</p>
<p>
<%=form.label :email%><br/>
<%= form.text_field :email %>
</p>
<%= submit_tag "save changes" %>
<% end %>
<%= link_to ''Back'', {:action =>
''list''} %>
Thanks
Frederick Cheung wrote:> On Sep 28, 6:02�am, Faisal Basha
<li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:
>> Hey guys,
>>
>> Here''s an �error I get after I hit the submit button on the
editing
>> page:
>>
>> NameError in ClassifiedsController#update
>>
>> uninitialized constant ClassifiedsController
>>
>
> Does that controller exist (and in the right place) ?
>
> Fred
--
Posted via http://www.ruby-forum.com/.
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
On 28 September 2010 10:05, Faisal Basha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: Please don''t top post, it makes it difficult to follow the thread> hi, Yes the below code is what I have i.e update method inPresumably the ''yes'' is in response to Fred''s question: ''Does that controller exist (and in the right place) ?''> Classifieds_controller.rb....It should be classifieds_controller.rb (lower case) though I do not know whether that is the root of the problem. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> On 28 September 2010 10:05, Faisal Basha <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > Please don''t top post, it makes it difficult to follow the thread > >> hi, Yes the below code is what I have i.e update method in > > Presumably the ''yes'' is in response to Fred''s question: ''Does that > controller exist (and in the right place) ?'' > >> Classifieds_controller.rb.... > > It should be classifieds_controller.rb (lower case) though I do not > know whether that is the root of the problem. > > ColinCool, Now I understand....I think.... Classifieds_controller.rb.... def edit @classifed = Classified.find(params[:id]) end def update @classifed = Classified.find(params[:id]) if @classified.update_attributes(params[:classified]) flash[:notice] = "updated" redirect_to @classified else render :action => ''edit'' end end Edit.rhtml <h1>Editing Classified: <%= :title -%></h1> <% form_for @classified do |form| %> <%=form.error_messages%> <p> <%=form.label :title%><br/> <%= form.text_field :title %> </p> <p> <%=form.label :price%><br/> <%= form.text_field :price %> </p> <p> <%=form.label :location%><br/> <%= form.text_field :location %> </p> <p> <%=form.label :description%><br/> <%= form.text_area :description %> </p> <p> <%=form.label :email%><br/> <%= form.text_field :email %> </p> <%= submit_tag "save changes" %> <% end %> <%= link_to ''Back'', {:action => ''list''} %> Thanks -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.