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
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
On Sep 28, 6:02 am, Faisal B. [email protected] 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
On 28 September 2010 10:05, Faisal B. [email protected] 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.
Colin
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
<% 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 C. wrote:
On Sep 28, 6:02�am, Faisal B. [email protected] 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
Colin L. wrote:
On 28 September 2010 10:05, Faisal B. [email protected] 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.Colin
Cool, 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
<% 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs