formtastic does not save at all

18 views
Skip to first unread message

Soichi Ishida

unread,
Sep 22, 2012, 1:34:08 AM9/22/12
to rubyonra...@googlegroups.com
Rails 3.1.3

I am using Formtastic gem in order to deal with multi-select
dependencies.


<%= semantic_form_for(@give) do |f| %>
<%= f.inputs do %>
<%= f.input :departure,
:collection => Departure.find(:all, :order=>:city).collect{ |c|
[c.city,c.id]},
:required=>true %>
<div id="destinationCity">
<%= render :partial => 'destination' %>
</div>
<div id="airlineCompany">
<%= render :partial => 'airline' %>
</div>
<div id="flight_name">
<%= render :partial => 'flight_name' %>
</div>
<%= f.input :day_departure, :as => :date_select, :hint => 'Select a
date',
:start_year => Time.now.year,
:label => "Departure date" %>
<%= f.input :weight %>
<%= f.input :check_in %>
<% end %>
<%= f.actions do %>
<%= f.action :submit, :button_html => { :class => "btn btn-large
btn-primary" } %>
<% end %>
<% end %>


The partials and jQuery ajax functions work properly.

But the problem is the clicking the submit button does not do anything
at all!!!!

If there is an error in saving the data, it should show some kind of
message in the console.
But the button simply does nothing.

I don't think it matters, but the gives_controller is the following.


def create
@give = current_user.gives.build(params[:give])
respond_to do |format|
if @give.save
format.html { redirect_to @give, notice: 'Give was successfully
created.' }
format.json { render json: @give, status: :created, location:
@give }
else
format.html { render action: "new" }
format.json { render json: @give.errors, status:
:unprocessable_entity }
end
end
end

If there is at least an error, I may be able to provide more
information, but the submit action does not do anything, so I am stuck
here.

Can anyone guess where the problem is?

soichi

--
Posted via http://www.ruby-forum.com/.

Hans

unread,
Oct 2, 2012, 11:30:32 AM10/2/12
to rubyonra...@googlegroups.com
I had a similar problem, and you can read on what I found on github
https://github.com/rails/rails/issues/6701

---------------------------
Reply all
Reply to author
Forward
0 new messages