ruby on rails - Mercury editor not working properly -


if save 'lorem ipsum', that's appears after refresh:

--- !ruby/hash:activesupport::hashwithindifferentaccess randompagename: !ruby/hash:activesupport::hashwithindifferentaccess type: full data: !ruby/hash:activesupport::hashwithindifferentaccess {} value: lorem ipsum snippets: !ruby/hash:activesupport::hashwithindifferentaccess {}  

everything default.

the github repo here: https://github.com/gwuix2/gerse

the format in mercury editor sends params little different. this

{"content"=>{"title"=>{"type"=>"simple", "data"=>{}, "value"=>"hello world"}} 

so normal @post.update_attributes(params[:post]) wont work.

you write private method like

def extract_params(params)   attr = {}   params[:content].each { |key, value| attr[key.to_sym] = value['value'] }   attr end 

and call @post.update_attributes(extract_params(params))


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -