Sha256: fd53c29f7b7ebcc638814a51d3a9b6a6e47bd3b1efcb72fce4296bfb4591dd82
Contents?: true
Size: 753 Bytes
Versions: 12
Compression:
Stored size: 753 Bytes
Contents
module Admin::Resources::DataTypes::HasOneHelper def typus_form_has_one(field) setup_relationship(field) @items = Array.new if item = @item.send(field) @items << item end # TODO: Find a cleaner way to add these actions ... @resource_actions = [["Edit", {:action=>"edit"}, {}], ["Trash", { :resource_id => @item.id, :resource => @resource.model_name, :action => "destroy" }, { :confirm => "Trash?" }]] options = { :resource_id => nil, @reflection.foreign_key => @item.id } render "admin/templates/has_one", :association_name => @association_name, :add_new => @items.empty? ? build_add_new(options) : nil, :table => build_relationship_table end end
Version data entries
12 entries across 12 versions & 1 rubygems