Skip to content

Commit

Permalink
Merge pull request #1741 from joseluistorres/master
Browse files Browse the repository at this point in the history
Issue with multilevel model relationship #1715
  • Loading branch information
James McKinney committed Nov 7, 2012
2 parents 30b36e9 + 849e37e commit c092d36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/active_admin/inputs/filter_select_input.rb
Expand Up @@ -12,7 +12,11 @@ def input_options
end

def method
super.to_s.sub(/_id$/,'').to_sym
if super.to_s.scan(/_id/).count('_id') == 1
super.to_s.sub(/_id$/, '').to_sym
else
super.to_s.to_sym
end
end

def extra_input_html_options
Expand Down
2 changes: 2 additions & 0 deletions spec/unit/filters/filter_form_builder_spec.rb
Expand Up @@ -157,6 +157,8 @@ def filter(name, options = {})
it "should render as belongs to select" do
body.should have_tag("select", :attributes => {
:name => "q[author_id_eq]"})
body.should have_tag("option", "john_doe", :attributes => {
:value => @john.id })
body.should have_tag("option", "jane_doe", :attributes => {
:value => @jane.id })
end
Expand Down

0 comments on commit c092d36

Please sign in to comment.