Re: Unitialized constant controller

Faisal Basha
Tue, 28 Sep 2010 09:05:13 -0000

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

Editing Classified: <%= :title -%>

 <% form_for @classified do |form| %>
   <%=form.error_messages%>

<%=form.label :title%>
   <%= form.text_field :title %>



<%=form.label :price%>
     <%= form.text_field :price %>



<%=form.label :location%>
  <%= form.text_field :location %>



<%=form.label :description%>
  <%= form.text_area :description %>



<%=form.label :email%>
  <%= form.text_field :email %>


  <%= 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.