Open nratter opened 8 years ago
This might be a duplicate of issue #404 Do you get any errors on the browser console output?
Was this ever figured out? I am trying to fix this now
fwiw, i am having the same issue... any hint is highly appreciated.
in the view:
<%= best_in_place_if(policy(@tradeplan).edit?, @tradeplan, :instrument, as: :select, collection: Instrument.all.order(:id).map { |i| [i.id, i.symbol] }, display_as: :symbol) %>
the collection:
irb(main):004:0> Instrument.all.order(:id).map { |i| [i.id, i.symbol] } Instrument Load (0.4ms) SELECT "instruments".* FROM "instruments" ORDER BY "instruments"."id" ASC => [[1, "ES"], [2, "NQ"], [3, "RTY"], [4, "YM"]]
the model method:
def symbol self.instrument.symbol end
thanks, Andreas
i think i've found it - at least for my use case...
:instrument is referring to an association introduced by belongs_to in the model... the proper attribute is :instrument_id, though..
no wonder it cant map an association to an array of id's and (in my case) symbols...
so, changing the view to:
<%= best_in_place_if(policy(@tradeplan).edit?, @tradeplan, :instrument_id, as: :select, collection: Instrument.all.order(:id).map { |i| [i.id, i.symbol] }, display_as: :symbol) %>
does the trick..
hope this helps, Andreas
I'm having an issue where best in place select boxes aren't displaying. We have a large project with react_on_rails and Materialize installed. I'm not sure if one of those 2 things are messing with the select box. All other BIP forms are working corrrectly. Here's my code for my select box...
<%= best_in_place @organization, :default_social_feed, as: :select, collection: %w(Facebook Twitter)>
It displays on the view as just a
-
. Inspecting this dash shows the following...If I click the
-
on the view, it changes the html to the following...The
-
then goes away. No select box ever appears. I also can't find any conflicting CSS code that might be causing problems.Any ideas?
Thanks, Nick