<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohammed Ba-Saleh on Medium]]></title>
        <description><![CDATA[Stories by Mohammed Ba-Saleh on Medium]]></description>
        <link>https://medium.com/@c.mohamed38?source=rss-d0c9f6983851------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u4yag9nK9IsKxgeUlhO6DQ.jpeg</url>
            <title>Stories by Mohammed Ba-Saleh on Medium</title>
            <link>https://medium.com/@c.mohamed38?source=rss-d0c9f6983851------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 09:13:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@c.mohamed38/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How To Upgrade Rails To 5.2]]></title>
            <link>https://medium.com/@c.mohamed38/how-to-upgrade-rails-to-5-2-d78a6faf1adb?source=rss-d0c9f6983851------2</link>
            <guid isPermaLink="false">https://medium.com/p/d78a6faf1adb</guid>
            <category><![CDATA[upgrade]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Mohammed Ba-Saleh]]></dc:creator>
            <pubDate>Thu, 27 Jun 2019 08:08:20 GMT</pubDate>
            <atom:updated>2019-06-27T08:08:20.015Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Many developers are afraid to upgrade their projects to version 5.2, in this topic I will give what are the things you do as a developer to upgrade your project .</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8UpUiQQv4REtIPhhDsno9g.jpeg" /><figcaption>Upgrade Rails To 5.2</figcaption></figure><p>Hello Developers, In recent months, I have read a lot of articles about upgrading your project from 5.1 to 5.2 .<br>I have noticed that things are ambiguous for people who want to upgrade their projects.<br>In this matter we will enter into the core of the matter, and what are the things that you do in order.</p><h4><strong>Ruby Version .</strong></h4><p>Like Rails 5.0 and 5.1, <a href="https://weblog.rubyonrails.org/2018/4/9/Rails-5-2-0-final/">Rails 5.2</a> requires at least <a href="https://www.ruby-lang.org/en/news/2015/04/13/ruby-2-2-2-released/">Ruby 2.2.2</a>.</p><p>A week ago I’ve upgraded my project and will tell you what I did when I changed the versions Rails From 5.1.4 to 5.2.3 and Ruby From 2.4.1 to 2.6.0</p><blockquote><strong>Regarding the things that have been changed on Ruby , it follows :</strong></blockquote><ol><li>First install the ruby version if you want to change the Ruby version, so I have already installed the version 2.6 .</li><li><em>In file .ruby-version change version to 2.6.0 or any version used, for me to use the version 2.6 and this file exist on root , If you don’t have this file , must you add it in root .</em></li><li><em>Add ruby version no </em><strong><em>GemFile , </em></strong><em>like</em><strong><em> </em></strong><em>ruby ‘2.6’ or any version used .</em></li><li>After that, run this command cd . in the path of your project, this is <strong>Gemset</strong> creation on the ruby release .</li></ol><blockquote><strong>Regarding the things that have been changed on Rails , it follows :</strong></blockquote><ol><li>Updating the Rails version in the <strong>Gemfile </strong>to 2.5.3 .</li><li>Remove file <strong><em>gemfile.lock </em></strong>and run <strong><em>bundle bundle </em>install &amp;&amp; <em>bundle update</em></strong> , here we will install the all <strong>gems</strong> and update it to conform to the latest releases .</li><li>After updating the Rails version in the <strong>Gemfile and run <em>bundle </em>install &amp;&amp; <em>bundle update</em> , </strong>run this command <strong>app:update </strong>and hit &#39;a&#39; to accept all changes<strong>, </strong>this will help you with the creation of new files and changes of old files in an interactive session .</li></ol><p>Your project has now been successfully upgraded , and you can run the server to make sure .</p><h4><strong>Application code:</strong></h4><p>There were not too many deprecation&#39;s between 5.1 and 5.2 compared to past releases <a href="https://guides.rubyonrails.org/5_2_release_notes.html#upgrading-to-rails-5-2">(see the full changelog here)</a>.</p><p><strong>Active Storage:</strong></p><blockquote>Active Storage facilitates uploading files to a cloud storage service like Amazon S3, Google Cloud Storage, or Microsoft Azure Storage and attaching those files to Active Record objects. It comes with a local disk-based service for development and testing and supports mirroring files to subordinate services for backups and migrations.</blockquote><p>Active Storage is a replacement for <a href="https://rubygems.org/gems/paperclip/">Paperclip</a> and other gems, like <a href="https://github.com/shrinerb/shrine">Shrine</a>. Paperclip in particular <a href="https://github.com/thoughtbot/paperclip#deprecated">has been deprecated</a>.</p><p>You can get more about active storage <a href="https://medium.com/alturasoluciones/setting-up-rails-5-active-storage-with-amazon-s3-3d158cf021ff">here</a></p><p><strong>Credentials:</strong></p><blockquote>Another major feature is the introduction of Credentials. It will eventually replace the current config/secrets.yml. Since there are also encrypted secrets (config/secrets.yml.enc), its intention is to clear up the confusion.</blockquote><p>Your private credentials will reside in config/credentials.yml.enc, a file that can be safely committed into your repository (its contents are encrypted). To un-encrypt them, there&#39;s a master key (config/master.key) which should <em>NOT</em> be in your repository (it&#39;s git-ignored by default if you start a new Rails 5.2 app). To edit the credentials, you don&#39;t directly access credentials.yml.enc, instead, there&#39;s a bin/rails credentials:edittask which opens an unencrypted version of the file (as long as you have the master key).</p><p>Thank you to be with me in this article! see you in next version of rails and new action text framework at the begin of new year</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d78a6faf1adb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails How to install wicked PDF , and how to write code]]></title>
            <link>https://medium.com/@c.mohamed38/rails-how-to-install-wicked-pdf-and-how-to-write-code-e98f423a9adc?source=rss-d0c9f6983851------2</link>
            <guid isPermaLink="false">https://medium.com/p/e98f423a9adc</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[wicked-pdf]]></category>
            <category><![CDATA[wkhtmlttopdf]]></category>
            <dc:creator><![CDATA[Mohammed Ba-Saleh]]></dc:creator>
            <pubDate>Sat, 24 Feb 2018 12:35:16 GMT</pubDate>
            <atom:updated>2018-02-24T13:11:55.650Z</atom:updated>
            <content:encoded><![CDATA[<p>Uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML</p><blockquote><strong><em>First Step: install gem</em></strong></blockquote><p><strong><em>1 </em></strong><em>- </em><strong><em>add</em></strong><em> this gem ‘</em><strong><em>wicked pdf</em></strong><em>’, in GemFile, thin run </em><strong><em>bundle</em></strong><em><br></em><strong><em>2 </em></strong><em>- create the initialize using this command </em><strong><em>rails g wicked_pdf</em></strong><em><br></em><strong><em>3 </em></strong><em>- </em><strong><em>add</em></strong><em> this code , in folder this config/initializers/mime_types.rb</em></p><blockquote><em>Mime::Type.register “application/pdf”, :pdf</em></blockquote><p><strong>4 </strong>-<em> </em><strong><em>install </em></strong><em>this gem ‘wkhtmltopdf-binary’</em></p><blockquote><em>If your wkhtmltopdf executable is not on your webserver’s path, you can configure it in an initializer<br> wicked.config { <br> exp_path: ‘/user/local/bin/wkhtmlttopdf’<br> }</em></blockquote><blockquote><strong>Second Step: code and view html</strong></blockquote><p><strong><em>1</em></strong><em>- </em><strong><em>add</em></strong><em> code in your controller, In this example I am inheriting from controller V1::ApiController , like this</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*v3lrcFmjB8dPQdhJVFw7vg.png" /><figcaption><strong><em>generate pdf</em></strong></figcaption></figure><p><em>2 - </em><strong><em>create </em></strong><em>PDF view ,contain on design pdf used HTML .pdf .</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*a7d2Tl_-paViS_ZTSklT9w.png" /><figcaption>path view</figcaption></figure><p><em>3- if you want work </em><strong><em>format</em></strong><em> in page pdf read this topic </em><a href="https://github.com/mileszs/wicked_pdf#advanced-usage-with-all-available-options"><strong><em>Advanced Usage with all available options</em></strong></a></p><blockquote><strong>Third Step : Create pdf ( super advanced usage )</strong></blockquote><p><em>super advanced usage , if you need create pdf , this section an provide that : </em><strong><em><br> • create a pdf from a string</em></strong><em><br> pdf = WickedPdf.new.pdf_from_string(‘&lt;h1&gt;Hello There!&lt;/h1&gt;’) .</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*UCbhWgkSviO_w-3dqbgoyQ.png" /><figcaption><strong>generate pdf from string</strong></figcaption></figure><p><em>* </em><strong><em>create a pdf file from a HTML file without converting it to string<br> Path must be absolute path</em></strong><em><br>pdf = WickedPdf.new.pdf_from_html_file(‘/your/absolute/path/here’)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*lrxC2U4WnRFMg93g9hgT4g.png" /><figcaption><strong>generate pdf <em>from a HTML file without</em></strong></figcaption></figure><p><strong><em>* create a pdf from a URL</em></strong><em><br> pdf = WickedPdf.new.pdf_from_url(https://medium.com/%E2%80%9C%3C/em%3E%3Ca%20href=%22/service/https://github.com/mileszs/wicked_pdf%22%3E%3Cem%3Ehttps://github.com/mileszs/wicked_pdf%3C/em%3E%3C/a%3E%3Cem%3E%E2%80%9D)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*ihCQWzBguSoORIEdpXx6SA.png" /><figcaption><strong>generate pdf <em>from URL</em></strong></figcaption></figure><p><em>* </em><strong><em>create a pdf from string using templates, layouts and content option for header or footer</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PmssLuQQrcqpzJuBIv3NWw.png" /><figcaption><strong>generate pdf <em>from string using templates …</em></strong></figcaption></figure><p><strong><em>* It is possible to use footer/header templates without a layout, in that case you need to provide a valid HTML document</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*owJ-Ckvzeddkotr6zNUXxQ.png" /><figcaption><strong>generate pdf <em>from string using templates … , use footer/header</em></strong></figcaption></figure><p><strong><em>* or from your controller, using views &amp; templates and all wicked_pdf options as normal</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*egIFkYJIhC8u7OmB9G7WsA.png" /><figcaption><strong>generate pdf <em>from string using views &amp; templates</em></strong></figcaption></figure><p><strong><em>* then save to a file</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*9YkQD-hdV7UQ5A-j9PYAFQ.png" /><figcaption><strong>save pdf file</strong></figcaption></figure><p><strong><em>* or use send_data(pdf)</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*ahQRb2AIK2u-AwUesWF2uw.png" /><figcaption><strong>download pdf file</strong></figcaption></figure><blockquote><strong><em>Finally : Pass attributes in view pdf</em></strong></blockquote><p><strong><em>if you want pass attributes into view using @ instances attributes</em></strong></p><blockquote><strong><em>Docu : </em></strong><a href="https://github.com/mileszs/wicked_pdf"><em>https://github.com/mileszs/wicked_pdf</em></a></blockquote><p><em>Thank you, and sorry for taking your time in reading</em> <strong><em>Mohammed Basaleh</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e98f423a9adc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>