gregbell/active_admin — Issue #645: has_many and my wysiwyg
Author: jdkealy
Created: 2011-10-19 05:31:16+00:00
State: open

Hi,

I have two different issues.

#1 i love the way active admin handles has_many relationships with a simple DSL like so:

ActiveAdmin.register Artist do
form do |f|
f.inputs do
f.input :name
f.input :description
end

f.inputs "ArtistLinks" do
f.has_many :artist_links do |j|
j.inputs :title, :url
end
end

f.buttons
end
end

The ability to add more links at the bottom of the form is great.

However,I have been using a wyiswyg which i can't seem to get working in this format. I've been using/adding it with a partial like so:

ActiveAdmin.register NewsItem do
index do
column :title
column :created_at
default_actions
end
form :partial => "/news_items/form"
end

#/app/views/news_item/_form.html.erb
<%= javascript_include_tag "/javascripts/ckeditor/ckeditor.js" %>
<%= semantic_form_for [:admin, @news_item], :multipart => true do |f| %>
<%= f.inputs :title, :photo, :excerpt %>
<%= cktext_area_tag("news_item[content]", @news_item.content) %>
<%= f.submit %>
<% end %>

However,
in my partial, i can't seem to be able to make the has_many relationship nicely like so:
f.inputs "ArtistLinks" do
f.has_many :artist_links do |j|
j.inputs :title, :url
end
end

Could you either explain to me how to get my wysiwyg which uses a form helper cktext_area_tag into my admin resource or explain to me how to get that nice has_many into my view partial?

Thanks a bunch!