Nested hash in erb

returning post data from postgres jsonb
@post = {:id=>1, :data=>{“tags”=>“tag1”, “title”=>“test”}}

==> 1 ==> works

<%= post[:data] %>

==> {"tags"=>"tag1", "title"=>"test"} correct

<%= post[:data][:title] %>

==> error

any help ? thks

Emply Prep wrote in post #1176161:

returning post data from postgres jsonb
@post = {:id=>1, :data=>{“tags”=>“tag1”, “title”=>“test”}}

==> 1 ==> works

<%= post[:data] %>

==> {"tags"=>"tag1", "title"=>"test"} correct

<%= post[:data][:title] %>

==> error

any help ? thks

post[:data][“title”]

or

post[:data][:title.to_s]

:wink:

Thks - worked!

Have you figured out why or do you need explanation?