Skip to content

Instantly share code, notes, and snippets.

@mangantj
Created April 24, 2013 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mangantj/5452758 to your computer and use it in GitHub Desktop.
Save mangantj/5452758 to your computer and use it in GitHub Desktop.
def new
@contact = Contact.new
@address = Address.new
@e_mail_address = EMailAddress.new
@phone_number = PhoneNumber.new
@addresses = Address.find(:all)
@e_mail_addresses = EMailAddress.find(:all)
@phone_numbers = PhoneNumber.find(:all)
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contact }
format.js { render partial: 'form', content_type: :html}
end
end
$(function(){
$('#new_contact').bind('ajax:success', function(e, data) {
$.facebox(data);
//Set form to remote
$("#facebox form").attr("data-remote", "true");
//Hide extra forms (address,email,phonenumber)
$("#contact_extras").hide();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment