i am newbie and was trying to learn rails by following a tutorial
which uses attachment_fu to upload videos .! every thing was working
till i edited something somewhere ! the problem is that nothing
happens when i click the submit button
the new.html.erb is as follows and it displays well too
and the create function in the Controller is as follows
def create
@advertisement = Advertisement.new(params[:advertisement])
#@advertisement.write_to_log
if @advertisement.save
@advertisement.convert
flash[:notice] = 'Advertisement has been uploaded'
redirect_to :action => 'index'
else
@advertisements = Advertisement.find(:all)
render :action => 'new'
end
end
even deleting the create function , it shows no error but returns to
index page when submit button clicked . it seems that this function is
not called properly
even deleting the create function , it shows no error but returns to
index page when submit button clicked . it seems that this function is
not called properly
what you got is this:
<% form_for(@advertisement, :html => { :multipart => true }) do |f|
%>
<%= f.text_field :title %>
<%= f.text_area :description %>
<%# … %>
<%= f.submit ‘Submit’ %>
now try changing your first line to:
<% form_for :advertisement, @advertisment, :url => { :action =>
“create” }, :html => { :multipart => true } do |f| %>