This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FactoryGirl.define do | |
factory :slideshow_image, class: "Image" do | |
association :imageable, :factory => :slideshow | |
# other attributes for slideshow model | |
end | |
factory :article_image, class: "Image" do | |
association :imageable, :factory => :article | |
# other attributes for article model | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_field(link, association, content) { | |
var new_id = new Date().getTime(); | |
var regexp = new RegExp("new_" + association, "g") | |
$(link).parent().before(content.replace(regexp, new_id)); | |
} | |
function remove_field = (link) { | |
$(link).siblings("input[type=hidden]").val(1); | |
$(link).closest(".fieldset").hide(); | |
} |