Skip to content

Instantly share code, notes, and snippets.

@cuciferus
Created November 29, 2012 10:47
Show Gist options
  • Save cuciferus/4168156 to your computer and use it in GitHub Desktop.
Save cuciferus/4168156 to your computer and use it in GitHub Desktop.
<%= link_to "Adauga retetar", new_retetar_path, :data=>{:toggle=>"modal", :target => "#newRetetarModal"}, :remote => true %>
<div id="newRetetarModal" class="modal hide fade">
<button type="button" class="close" data-dismiss="modal">x</button>
<div class="page-header">
<h2> Retetar nou</h2>
</div>
<% @retetar = Retetar.new %>
<%= render :partial => '/retetars/form' %>
</div>
controller:
def create
@retetar = Retetar.new(params[:retetar])
respond_to do |format|
if @retetar.save
format.js {render}
format.html { redirect_to @retetar, notice: 'Retetar was successfully created.' }
format.json { render json: @retetar, status: :created, location: @retetar }
else
format.html { render action: "new" }
format.json { render json: @retetar.errors, status: :unprocessable_entity }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment