best-in-place

How can I change serialized data using the best_in_place gem?

ε祈祈猫儿з 提交于 2019-12-02 04:26:59
I have a model with serialized data and I want to edit this data using the best_in_place gem. This isn't possible by default when using the best_in_place gem. How can this be done? It can be done by extending method_missing and respond_to_missing? to forward the requests to the serialized data. Lets say you have your serialized Hash in data . In the class that's containing the serialized data you can for example use this code: def method_missing(method_name, *arguments, &block) # forewards the arguments to the correct methods if method_name.to_s =~ /data_(.+)\=/ key = method_name.to_s.match(

how to use Best In Place with twitter bootstrap

我是研究僧i 提交于 2019-12-02 02:58:00
问题 I haven't seen any documentation from this.. If I have <%= best_in_place @user, :city, type=> :input, %> I need to include the data-provide="typeahead" <%= best_in_place @user, :city, type=> :input,:data => {:provide => "typeahead"} %> and to include the source <%= best_in_place @user, :city, :type=> :input, :data => {:provide => "typeahead", :source => City.getcities.to_json} %> assume City.getcities.to_json returns a proper json list with city names This doesn't work... 回答1: With the :data

how to use Best In Place with twitter bootstrap

Deadly 提交于 2019-12-01 23:01:31
I haven't seen any documentation from this.. If I have <%= best_in_place @user, :city, type=> :input, %> I need to include the data-provide="typeahead" <%= best_in_place @user, :city, type=> :input,:data => {:provide => "typeahead"} %> and to include the source <%= best_in_place @user, :city, :type=> :input, :data => {:provide => "typeahead", :source => City.getcities.to_json} %> assume City.getcities.to_json returns a proper json list with city names This doesn't work... nemesv With the :data option you can set the data- attibutes on the generated span and not on the input itself. If you want