returning post data from postgres jsonb
@post = {:id=>1, :data=>{“tags”=>“tag1”, “title”=>“test”}}
<%= post[:data] %>
==> {"tags"=>"tag1", "title"=>"test"} correct
<%= post[:data][:title] %>
==> error
any help ? thks
returning post data from postgres jsonb
@post = {:id=>1, :data=>{“tags”=>“tag1”, “title”=>“test”}}
any help ? thks
Emply Prep wrote in post #1176161:
returning post data from postgres jsonb
==> 1 ==> works
@post = {:id=>1, :data=>{“tags”=>“tag1”, “title”=>“test”}}<%= post[:data] %>
==> {"tags"=>"tag1", "title"=>"test"} correct
<%= post[:data][:title] %>
==> error
any help ? thks
post[:data][“title”]
or
post[:data][:title.to_s]
Thks - worked!
Have you figured out why or do you need explanation?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs