Search engine spider don't support my site's encoding - character-encoding

Ok this is my last hope to find a solution. I have a site, built with joomla 3.0, which contains greek characters for the most part. The content is displayed properly with any browser, and I have installed correctly the greek langouage at root/language/el-GR.
I want to make some seo actions, so I found this site webconfig.com, which have a search engine spider simulator, I typed my site's url and this is how it looks in search engines' perspective:
Spidered Text : Home ΞΞ½Ξ±ΞΆΞ�ΟΞ·ΟΞ·... ViΞ»a SuΞΌΞΌer! ΞΞ±
ΞΌΞ΅Ξ―Ξ½Ξ΅ΞΉΟ ΞΊΞΉ Ξ΅ΟΟ ΟΞ΅ Ξίλα! HomeΞίδη
ΞΞΉΞ±ΞΊΞΏΟΟΞ½ΞναλλακΟΞΉΞΊΞ­Ο ΞΞΉΞ±ΞΊΞΏΟΞ­ΟΞΞ³ΟΞΉΞ±
Ξ¦ΟΟηΧαλάΟΟΟΞ·ΞΞ΅ΟάνΟΟΞΌΞ±Ξ£ΟΞ΅ΟΞΉΞΊΞ¬ ΞΌΞ΅
ΡμάΟΞ ΞΏΞΉΞΏΞΉ
ΡίμαΟΟΞ΅ΞΟΞΉΞΊΞΏΞΉΞ½ΟΞ½Ξ―Ξ±Ξ₯ΟΞ·ΟΞ΅ΟΞ―Ξ΅ΟΞ
Ξ±ΟΞΏΟΞ­ΟΞΟΞ¬ΟΞ·ΟΞ·Ξ£ΟνδΡΟΞ· ΟΟΞ�ΟΟΞ· Home Ξ ΞΉΞΏ
δημοΟΞΉΞ»Ξ� Ξ¬ΟΞΈΟΞ± Ξ ΞΞΉΞ³ΞΉΞ±Ξ»ΟΟ Ξ€ΞΏ ΞΊΟΞ�ΞΌΞ± Verve
KΟΞ�ΞΌΞ±ΟΞ± Ξarie ΞΞ±ΟΞΌΞ¬ΟΞΉΞ± Ξ½Ξ΅ΟΟΟΞΉΟΟΞ· βίλα
Ξλένη Daphnis Villas ΞΞ±ΟΞΌΞ¬ΟΞΉΞ± Ξ½Ξ΅ΟΟΟΞΉΟΟΞ· βίλα
Ξλένη Ξ ΞΈΞ±ΟΞΌΞ¬ΟΞΉΞ± Ξ½Ξ΅ΟΟΟΞΉΟΟΞ· βίλα Ξλένη,
Ρίναι ΟΟΞΉΟΞΌΞ­Ξ½Ξ· 300ΞΌ Ξ±ΟΟ ΟΞ·Ξ½ ΟΞ±Οαλία ΞΊΞ±ΞΉ
Ξ±ΟΞΏΟΡλΡίΟΞ±ΞΉ Ξ±ΟΟ 5 ΞΊΟΡβαΟοκάμαΟΞ΅Ο Ξ£ΟΞΏΞ½
Ξ΅ΟΞ¬Ξ½Ο ΟΟΞΏΟΞΏ Ρίναι Ξ· ΞΊΟΟΞΉΞ± διΟΞ»Ξ�
ΞΊΟΡβαΟοκάμαΟΞ± ΞΌΞ΅ ΟΞΏ ΟΞ±ΟάθΟΟΞΏ ΟΞ·Ο ΞΊΞ±ΞΉ
ΟΞΏ Ξ±Ξ½ΞΏΞΉΟΟΟ ΟΞΆΞ±ΞΊΞΏΟΞΆΞΉ ΟΞ·Ο Ξ½Ξ± βλέΟΡι ΟΞΏ
Ξ±ΟΞ­ΟΞ±Ξ½ΟΞΏ γαλά΢ιο ΞΊΞ±ΞΉ ΟΞΏ ηλιοβαΟίλΡμα.
ΞΞΉΞ±Ξ²Ξ¬ΟΟΞ΅ ΟΞ΅ΟΞΉΟΟΟΟΞ΅ΟΞ±: ΞΞ±ΟΞΌΞ¬ΟΞΉΞ±
Ξ½Ξ΅ΟΟΟΞΉΟΟΞ· βίλα Ξλένη KΟΞ�ΞΌΞ±ΟΞ± Ξarie Ξ
ΞΌΞ­ΟΞ± ΞΌΟΞΏΟΡί Ξ½Ξ± ξΡκινΞ�ΟΡι ΞΌΞ΅ Ξ­Ξ½Ξ±
ΟλοΟΟΞΉΞΏ ΟΟΟΞΉΞ½Ο ΟΟΞΏ ΞΊΞ±ΟΡνΡίο ΟΞΏΟ
ΞΊΟΞ�ΞΌΞ±ΟΞΏΟ Ξarie ΟΞ±ΟΞ­Ξ± ΞΌΞ΅ ΟΞ·Ξ½ Ξ±Ξ½Ξ±ΟΞΏΞ»Ξ� ΟΞΏΟ
ηλίοΟ. ΞΞΉΞ±Ξ²Ξ¬ΟΟΞ΅ ΟΞ΅ΟΞΉΟΟΟΟΞ΅ΟΞ±: KΟΞ�ΞΌΞ±ΟΞ±
Ξarie Daphnis Villas Ξ£ΟΞ·Ξ½ ΞΟΞ�ΟΞ·, ΟΟΞΏΞ½ Ξ ΟΟΞ³ΞΏ
ΨηλονέΟΞΏΟ ΟΞΏΟ Ξ Ξ»Ξ±ΟΞ±Ξ½ΞΉΞ¬, 15 ΟιλιΟΞΌΞ΅ΟΟΞ±
Ξ΄ΟΟΞΉΞΊΞ¬ ΟΞ·Ο ΟΟΞ»Ξ·Ο ΟΟΞ½ ΧανίΟΞ½, ΞΊΞ±ΞΉ ΞΌΟλιΟ
200 ΞΌΞ­ΟΟΞ± Ξ±ΟΟ ΟΞ· θάλαΟΟΞ±, Ξ²ΟΞ―ΟΞΊΞ΅ΟΞ±ΞΉ ΟΞΏΒ
Daphnis Villas. ΧλΟΞ·,Β ΞΟλη, ΦαίδΟΞ±Β ΞΊΞ±ΞΉΒ
Ξανάη, ΞΏΞΉ ΟΞ­ΟΟΞ΅ΟΞΉΟΒ Daphnis Villas ΞΞΉΞ±Ξ²Ξ¬ΟΟΞ΅
ΟΞ΅ΟΞΉΟΟΟΟΞ΅ΟΞ±: Daphnis Villas La Perla Villas ΀ο
ΟΟΞ³ΞΊΟΟΟΞ·ΞΌΞ± La Perla Villas Ξ±ΟΞΏΟΡλΡίΟΞ±ΞΉ Ξ±ΟΟ
ΟΟΟΟΞΊΞ±ΟΞ΅Ο ΞΊΞ±ΟΞΏΞΉΞΊΞ―Ξ΅Ο ΞΊΞ±ΞΉ Ξ½Ξ΅ΟΞΊΟΞΉΟΟΞ΅Ο
Ξ²Ξ―Ξ»Ξ΅Ο ΟΟΞ·Ξ½ ΞΊΞ±Οδιά ΟΞ·Ο ΞαλνΟΞ­ΟΞ±Ο. Ξ
ΟΟκΡιΟΞ±ΞΉ Ξ³ΞΉΞ± Ξ­Ξ½Ξ± ξΡνοδοΟΡίο ΟΞΏΟ Ξ­ΟΡι
ΟΞ±ΟΞ±ΞΊΟΞ·ΟΞΉΟΟΡί ΟΟ Β«ΞΞΉΞ±ΟΞ·ΟΞ·ΟΞ­ΞΏΒ» ΞΊΞ±ΞΉ
ΟΟΞΏΟΟΞ±ΟΞ΅ΟΞ΅ΟΞ±ΞΉ Ξ±ΟΟ ΟΞΏΞ½ ΞΞΈΞ½ΞΉΞΊΟ
ΞΟΞ³Ξ±Ξ½ΞΉΟΞΌΟ Ξ€ΞΏΟΟΞΉΟΞΌΞΏΟ (Ξ.Ξ.Ξ€). ΞΞΉΞ±Ξ²Ξ¬ΟΟΞ΅
ΟΞ΅ΟΞΉΟΟΟΟΞ΅ΟΞ±: La Perla Villas (c) 2012 by Maria Petriti,
Santarita Simoni. All Rights Reserved. HomeΞίδη
ΞΞΉΞ±ΞΊΞΏΟΟΞ½Ξ£ΟΞ΅ΟΞΉΞΊΞ¬ ΞΌΞ΅
ΡμάΟΞ₯ΟΞ·ΟΞ΅ΟΞ―Ξ΅ΟΞ£ΟνδΡΟΞ· ΟΟΞ�ΟΟΞ· Joomla Template
by Joomla51.com
I tried to add a meta http-equiv tag with the greek encoding right before the "jdoc:include" tag at my template's index.php but with no avail
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">
<jdoc:include type="head" />
I also tried a core hack to manualy change the utf-8 with iso-8859-7 in libraries/joomla/factory.php, which I know is not a good practice. The result was that the browser could not recognize the greek charactes as before but the simulator still gave the same outcome as before, so I changed back to utf-8.
Here's the site's url
http://www.vilasummer.eu/
Can you please help?

Related

Invalid base64 string from Ruby controller

All I want to do is respond with a base64 string when this action on my controller is contactacted.
class V1::AppProxyController < ApplicationController
def logo
send_file("#{Rails.root}/public/fresh_modal.png",
type: "image/png",
disposition: "inline")
end
But the response, when I put it into an online converter, does not return the image. Plus it has all those odd characters. What am I doing wrong?
"�PNG
IHDRZ
�*tEXtSoftwareAdobe ImageReadyq�e< iTXtXML:com.adobe.xmp<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.0-c060 61.134777, 2010/02/12-17:32:00 "> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmp:CreatorTool="Adobe Photoshop CS5 Windows" xmpMM:InstanceID="xmp.iid:56A07D6E335911E7B92CC44F92F10C15" xmpMM:DocumentID="xmp.did:56A07D6F335911E7B92CC44F92F10C15"> <xmpMM:DerivedFrom stRef:instanceID="xmp.iid:56A07D6C335911E7B92CC44F92F10C15" stRef:documentID="xmp.did:56A07D6D335911E7B92CC44F92F10C15"/> </rdf:Description> </rdf:RDF> </x:xmpmeta> <?xpacket end="r"?>&���IDATx��Yy�]U��]�6�7K;��L�^���(aS*�����(U�H��A!`E�
Fb�&P ����S�Bי��v��0�[�g���w�yCJĶ�5��{������߹t�i�ȥA��U-�ќ%2$袙��9¥���vl��*Pu��fd�G�C�h�vn����ς�$��K����"q(?��$��˒�ȥ��%8�s^�4���h� r�C[�'|�v�1)#��D������#���x�w�MO��
��C�����Q�H���y�������:�ʣ듮�pF��=��.RZ���?��t��'�Y�%����kZ#���|�&�wOx�B��N���љ�EȓG!��/�j�Q��̄c�q�j���gj�u�Չ��^��Z�%�T�q�S&��v��
i�l;
�A��>��#J�Ԁ��Kr���3^e��Q
�2�u�(�
�H.�ڕ�ۑ�kѿQ�}2��"H�%$�!\n� wC��9�<kmyзX��:.�L��w��}��*���e�O�T[�ӣ�G�кCfֶ'#�����`p%�
5f��Q,���9�#������.Wb�{ E�x;~�dp+��07Ɇ��m�Z��D�b0< :'�&���a��I���Z��zkM ������ wA.��
� �5����:�Bf�ޞ��y�-rVxal*!��+�s����v�|ځ�j��GÖ9ў<�Ga�єt(���bd���c;,�l���u���� � i�A{��Z�N��
M�����[�+>�{�ju�?N��y�Qu�Ċ��kv���Ha �S%!/#�Cx��G�����}Eu�"���!������(�mD��[�T���O��N��;v!�N�-�g"���Ӎ5r�}Wm�
�����.x�-�{-��ހ
���a�?#��.7J���7�~Zs�`jhS�J��ϋ��1��C�k��v�&�No]ek�lA\j��~pEz��)�r��؉����T&.x�>� i����HRG^S�Ly
y: �2h�u8��Upj!j����x���D�(]�q�'6�6���\�����H|v䜊s+�r/dnٺn�Cx��x�����Y�w:R!i-��Z���W�~�vl���[(�ߣR��i�}���h[ "���n���8�;�{�W�]B�R�>�l�\9'��m�Cu�V���G��(=
W=6ӓm���
Қ��z�oH�Q����ꅢ
�!�,r���t��Tq�"�-thQ�F��h+�g�|���[8 �b���ƹ�
��k��z��Z�݌�sh�/��e�1YfD�
hJ���x����J9?���I)>B?]�Ov�TA"��B�|/��$�q�δ�cC�v�Խ��� ��ja�;�Q�㺫�R��\���z?�Xi�H��+)��m���獪��~�mU���wUT�V�2x=RBeh�V�&��KE�F���u��L4��P�fv������3Fw[�]*��N� o���}��hq�,���kVa�F<6�8�A��AQ~�o��FF4���s�&8T1d��X*�(�6^��Ps�w�����#C���0R�z1M"�z�GUQDSD)I?��W)�N�}�a����:1�44}�~��2*��\o5�a�>�7�x�-����8�<� mĻ�޹Ɩ�!���=�FG�����0������N�x��#!�t��C��w��M�;�JQ��2Rt{��e�H�v�q>�H�#Ͳ��FQ�ݾcvH��y���J���>�5c�!�&��x����J0�lҥ9��r�
4���q ��r=��y�����t��p���Ә=�g�*�Z�:���XO�(� ��Qm���nJ���P���{��0���D3-j�C[�|g#��n�#���V����h*����5����i�?d%�u�R��B� ߉����h��fG���,h��,�;��.�U��oJ��I
�����8�!�����������t̒{16��S�0�]���P�i�Ci����H��Fd
=�K��,��+����m��y�w$������[�F�G=?���a8�=�J�ل��0J�\����c��ӡ�zk�G��_-ݟ����5�S+��G���/΃l��)<8��;��=\��M��2�K��V�%���؃��x�\g�|��ay+��B8�QEX,R��G��h�,R_�"Cf�,���j�LFDbic#�v5��
G}rQ��:+]�_���P�b�>�L^*�X����LD��8DE��'Γ&>?
"����0<2gL:��YuL����|��"�
7��~����Ɇ]]vY��Ts7�w8�\x�Dl�Ur<��eU~���)���g��&E7���n�On#�>��q�X+r��ZN��s�κ8DCj
G��HKن+�N�tg�V�Y�)_ڿc�-�r��3��5��B?���1`zvILa�Y���0v������k�=��ډ��(J�&������W#:{�[?�?�]�+[�����H�k�!�<�vf;��x�ڢ��&��-J��ǠÆE�"�+�5�4�^�yl ���b�*��a�Ɠ�B����
i�!�����i�:����b����c��#�j��p$�����:->�}הNǓE)�h9�OB�e��Ü�3��腦��\S5ca�ɘ,�p�C�C��T8���nK���X6L���c?� �r���B-���i>�*�ǁ��͂�����W
_l��ȳ[ૻ��W6Sh���#��I����<��6�H{%2A��g��60��.��A��m0J?t'`�<�a,,m�x>��q�K[Z> Z���'��.��y��5�M�� #ĝ�JₔSe��g����J��VtQ�^
��AyU�O�R[`FV*�U���d�A��K�a�S�����h�Gڑ���Y�?�б.�c)�1��~�_ƙ(S���IEND�B`�"
You need to encode the file to Base64 instead of returning the binary data
File.open("#{Rails.root}/public/fresh_modal.png", 'rb') do |img|
base64_file = 'data:image/png;base64,' + Base64.strict_encode64(img.read)
end
render plain: base64_file

how do I print a Rails POST request output?

I have this request:
post '/api/v1/fruit', params: valid_fruits, headers: lots_of_security
how can I see what's going on behind the scenes and see the many fruits contained in the raw output that will be sent after executing it?
[1] pry(#<Api::V1::InquiriesController>)> request
returns this very verbose and complete answer:
=> #<ActionDispatch::Request:0x0000aaaae4ba5308
#env=
{"rack.version"=>[1, 3],
"rack.input"=>#<StringIO:0x0000aaaae4bdffa8>,
"rack.errors"=>#<StringIO:0x0000aaaae4be0070>,
"rack.multithread"=>true,
"rack.multiprocess"=>true,
"rack.run_once"=>false,
"REQUEST_METHOD"=>"POST",
"SERVER_NAME"=>"www.example.com",
"SERVER_PORT"=>"80",
"QUERY_STRING"=>"",
"PATH_INFO"=>"/api/v1/inquiries",
"rack.url_scheme"=>"http",
"HTTPS"=>"off",
"SCRIPT_NAME"=>"",
"CONTENT_LENGTH"=>"141",
"rack.test"=>true,
"REMOTE_ADDR"=>"127.0.0.1",
"REQUEST_URI"=>"/api/v1/inquiries",
"HTTP_HOST"=>"www.example.com",
"CONTENT_TYPE"=>"application/x-www-form-urlencoded",
"HTTP_ACCEPT"=>"application/vnd",
"HTTP_AUTHORIZATION"=>"Bc29dEtvWGiYtmaZGTqL484r",
"HTTP_COOKIE"=>"",
"action_dispatch.parameter_filter"=>[:password],
"action_dispatch.redirect_filter"=>[],
"action_dispatch.secret_key_base"=>
"redacted",
"action_dispatch.show_exceptions"=>false,
"action_dispatch.show_detailed_exceptions"=>true,
"action_dispatch.logger"=>
#<ActiveSupport::Logger:0x0000aaaae205d4e8
#default_formatter=
#<Logger::Formatter:0x0000aaaae205d678 #datetime_format=nil>,
<page break> --- Press enter to continue ( q<enter> to break ) --- <page break>

How to replace last free space to nbsp in ruby

How I can replace last free space to in ruby?
I have in database this:
<h1>Hello dear friend!</h1>
<p>How are you?</p>
<figure><img src="..." alt="..." /></figure>
<p>Bye!</p>
And I need to have this "output":
<h1>Hello dear friend!</h1>
<p>How are you?</p>
<figure><img src="..." alt="..." /></figure>
<p>Bye!</p>
I tried to play with nokogiri:
text = Nokogiri::HTML::DocumentFragment.parse(...)
text.css('h1, h2, h3, h4, h5, h6, p, li').each do |tag|
tag_arr = tag.content.split(' ')
tag_last_words = tag_arr[tag_arr.length-2..tag_arr.length]
tag_return = tag_arr[0..-2].push(tag_last_words.join(' '))
tag_return = tag_return.join(' ')
tag.content = tag_return
end
but the I can't beat some "bugs":
all attributes and inner tags (html) are deleted
instead of I have &nbsp;
Why? To avoid single word wrapping to new line on mobile device. (JS is not an option in my case)

Extract plan from Stripe

How do I retrieve the Plan ID in Rails from Stripe's invoice.payment_succeeded webhook event?
I have tried the code below but keep on getting plan is nil error.
plan_id = event.data.object.lines.data[1].plan.id
Here is the web hook event.
{
"id"=>"evt_111111111",
"created"=>1207343135,
"livemode"=>true,
"type"=>"invoice.payment_succeeded",
"data"=>{
"object"=>{
"date"=>2437418246,
"id"=>"in_......",
"period_start"=>1406044997,
"period_end"=>1437238559,
"lines"=>{
"object"=>"list",
"total_count"=>1,
"has_more"=>false,
"url"=>"/v1/invoices/in_...../lines",
"data"=>[
{
"id"=>"sub_.....",
"object"=>"line_item",
"type"=>"subscription",
"livemode"=>true,
"amount"=>29900,
"currency"=>"cad",
"proration"=>false,
"period"=>{
"start"=>2437418246,
"end"=>2437418246
},
"quantity"=>1,
"plan"=>{
"interval"=>"month",
"name"=>"Business",
"created"=>2437446,
"amount"=>19900,
"currency"=>"cad",
"id"=>"P3",
"object"=>"plan",
"livemode"=>true,
"interval_count"=>1,
"trial_period_days"=>7,
"metadata"=>{},
"statement_description"=>nil
},
"description"=>nil,
"metadata"=>{}
}
],
"count"=>1
},
"subtotal"=>19900,
"total"=>19900,
"customer"=>"cus_.....",
"object"=>"invoice",
"attempted"=>true,
"closed"=>true,
"forgiven"=>false,
"paid"=>true,
"livemode"=>true,
"attempt_count"=>1,
"amount_due"=>19900,
"currency"=>"cad",
"starting_balance"=>0,
"ending_balance"=>0,
"next_payment_attempt"=>nil,
"webhooks_delivered_at"=>14022ert61,
"charge"=>"ch_......",
"discount"=>nil,
"application_fee"=>nil,
"subscription"=>"sub_......",
"metadata"=>{},
"statement_description"=>nil,
"description"=>nil
}
},
"object"=>"event",
"pending_webhooks"=>1,
"request"=>nil,
"webhook"=>{
"id"=>"evt_....."
}
}
You appear to only have a single item in the data list.
Note that Arrays in Ruby start at index 0.
I believe you will want to change data[1] to data[0].
Note, this can still break if there is a chance that the data list can be empty.

cannot acces multiply items xml api wunderground

I have this code:
Model:
class WeatherLookup
attr_accessor :temperature, :icon, :condition, :zip, :fcttext
def fetch_weather(city)
HTTParty.get("http://api.wunderground.com/api/api_key/forecast/lang:NL/q/IT/#{city.slug}.xml")
end
def initialize
weather_hash = fetch_weather
end
def assign_values(weather_hash)
hourly_forecast_response = weather_hash.parsed_response['response']['forecast']['txt_forecast']['forecastdays']['forecastday'].first
self.fcttext = hourly_forecast_response['fcttext']
self.icon = hourly_forecast_response['icon_url']
end
def initialize(city)
#city = city
weather_hash = fetch_weather(city)
assign_values(weather_hash)
end
end
city_controller:
#weather_lookup = WeatherLookup.new(#city)
city_view:
= #weather_lookup.fcttext
= image_tag #weather_lookup.icon
This work fine...i get the fist dataset of the forecastdays container. The xml from the api looks like this:
<response>
<version>0.1</version>
<termsofService>
http://www.wunderground.com/weather/api/d/terms.html
</termsofService>
<features>
<feature>forecast</feature>
</features>
<forecast>
<txt_forecast>
<date>2:00 AM CEST</date>
<forecastdays>
<forecastday>
<period>0</period>
<icon>clear</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/clear.gif</icon_url>
<title>zondag</title>
<fcttext>
<![CDATA[ Helder. Hoog: 86F. Light Wind. ]]>
</fcttext>
<fcttext_metric>
<![CDATA[ Helder. Hoog: 30C. Light Wind. ]]>
</fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>1</period>
<icon>clear</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/clear.gif</icon_url>
<title>zondagnacht</title>
<fcttext>
<![CDATA[ Helder. Laag: 61F. Light Wind. ]]>
</fcttext>
<fcttext_metric>
<![CDATA[ Helder. Laag: 16C. Light Wind. ]]>
</fcttext_metric>
<pop>0</pop>
</forecastday>
<forecastday>
<period>2</period>
<icon>partlycloudy</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/partlycloudy.gif</icon_url>
<title>maandag</title>
<fcttext>
<![CDATA[ Gedeeltelijk bewolkt. Hoog: 84F. Light Wind. ]]>
</fcttext>
<fcttext_metric>
<![CDATA[ Gedeeltelijk bewolkt. Hoog: 29C. Light Wind. ]]>
</fcttext_metric>
<pop>20</pop>
</forecastday>
<forecastday>
<period>3</period>
<icon>clear</icon>
<icon_url>http://icons-ak.wxug.com/i/c/k/clear.gif</icon_url>
<title>maandagnacht</title>
<fcttext>
<![CDATA[ Gedeeltelijk bewolkt. Laag: 63F. Light Wind. ]]>
</fcttext>
<fcttext_metric>
<![CDATA[ Gedeeltelijk bewolkt. Laag: 17C. Light Wind. ]]>
</fcttext_metric>
<pop>0</pop>
</forecastday>
I want to acces all the foracasts in the forecasts container by a loop, but when i change the hourly_forecast variable (.first) to .all or none i get the error message "can't convert String into Integer"
Someone ideas to fix this?
\
Once you remove .first from hourly_forecast, you are now returning a collection as opposed to a single item. That means your view won't work correctly so you'll need to update your view to render a collection. This is best done with a partial.
city_view will become:
= render partial: "weather_lookup", collection: #weather_lookup
Then create a partial named _weather_lookup.html.haml and include the following:
= #weather_lookup.fcttext
= image_tag #weather_lookup.icon
The underscore in front of the partial's filename is important as this is Rails convention so don't leave it out. When viewed, the partial will be rendered multiple times for every item in the collection.

Resources