Open proxygear opened 5 years ago
I tried a dirty fix :
puts "for #{name} #{locale}"
if (attributes[name].is_a?(Hash))
puts "add"
attributes[name][locale] = value
else
puts "fixe"
attributes[name] = {locale => attributes[name]}
end
#(attributes[name] ||= {})[locale] = value
However it does not work, as other data value can be already Hash
, like sections_content
and editable_elements
.
I guess somehow, attributes should start with an empty Hash
.
I guess load_tree and load_data should extract their data separately. Then a 3rd method should handle the final merge.
EDIT : the problem was not there but upper in the process
Looking at the code of lib/locomotive/steam/adapters/filesystem/yaml_loaders/page.rb
, I think it would need some rework.
My intuition would be to create a PageLeaf model that contains all the merging methods, leaving the page.rb
responsible of the list ?
The Travis CI
failed. I corrected the specs except spec/integration/repositories/page_repository_spec.rb
But I get the counters expecting different values depending of Filesystem
or MongoDB
cases.
My intuition is that the spec/fixtures/mongodb
files need to be updated to reflect the changes I did in the spec/fixtures/default/app/views/pages
...
Can someone point me how to do so ?
I make a extra pull request to highlight where I'm stuck.
I try to push an I18n page to production from staging data, using the following command line :
wagon deploy production -d -v -e staging
And get the following errors :
Here is a sample of the pointed code : https://github.com/locomotivecms/steam/blob/master/lib/locomotive/steam/adapters/filesystem/yaml_loaders/page.rb
The problem happen in the
(attributes[name] ||= {})[locale] = value
Fact is attributes contains already data from the initial language, and so collide.