<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sambit Mohanty</title>
    <description>The latest articles on DEV Community by Sambit Mohanty (@sambitmohanty954).</description>
    <link>https://dev.to/sambitmohanty954</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F346187%2F869570f2-6333-4810-89a3-c41667cd9af0.jpeg</url>
      <title>DEV Community: Sambit Mohanty</title>
      <link>https://dev.to/sambitmohanty954</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sambitmohanty954"/>
    <language>en</language>
    <item>
      <title>Rails Architecture in cloud platform</title>
      <dc:creator>Sambit Mohanty</dc:creator>
      <pubDate>Wed, 11 Mar 2020 04:52:28 +0000</pubDate>
      <link>https://dev.to/sambitmohanty954/rails-architecture-in-cloud-platform-21ji</link>
      <guid>https://dev.to/sambitmohanty954/rails-architecture-in-cloud-platform-21ji</guid>
      <description>&lt;p&gt;Thank you all for your immense responses, It really encouraged me to move forward to write the articles like this.&lt;/p&gt;

&lt;p&gt;So when i started to learn about rails, i wanted to create my own website and host it in Cloud platforms like(AWS/Azure/Google cloud platform) and for that i start doing R&amp;amp;D in internet.&lt;/p&gt;

&lt;p&gt;Here we’ll understand the basics of how the web, Cloud platform, the routes, and the MVC architecture work, using Ruby on Rails web framework. Let’s dive into the web world!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---_Ph_azv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3iwojl37q0miz40jjoae.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---_Ph_azv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3iwojl37q0miz40jjoae.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This one request cycle must be complete within 30 sec otherwise you will get an error like "Error Code 502 (Bad Gateway error) [Whoops, Server is taking too much time to respond]"&lt;/p&gt;

&lt;p&gt;Mainly this architecture focuses on 4 parts&lt;/p&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Web Server&lt;/li&gt;
&lt;li&gt;Middleware&lt;/li&gt;
&lt;li&gt;MVC Structure&lt;/li&gt;
&lt;li&gt;DB Server&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. Web Server
&lt;/h2&gt;

&lt;p&gt;Basically web server is:- &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A web server is a program that takes a request to your website from a user and does some processing on it. Then, it might give the request to your Rails app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So if you are working on personal project then the best web server is (Puma/Unicorn/Thin) but if you are a start-up company and want to build a enterprise level web app so the best Web server is Nginx and Puma as app server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bonus:- You Can use ELB(Elastic Load Balancer) in AWS instead of Nginx.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I know it's very confusing right now and you guys have lot of questions in your head. I also had so many questions when i am starting R&amp;amp;D. so let's break down the questions one by one.&lt;/p&gt;

&lt;h4&gt;
  
  
  a.  So the question is why are we using Nginx in Production???
&lt;/h4&gt;

&lt;p&gt;Nginx is a general webserver, it handles a request &amp;amp; if there is a matching file for that request it will return that file.Having nginx as a web server will help you in handling multiple requests much more efficiently. Being a multi threaded server it will distribute requests into multiple threads making your application more faster.&lt;/p&gt;

&lt;h4&gt;
  
  
  b. Why we use nginx with puma ???
&lt;/h4&gt;

&lt;p&gt;Whenever there's a request coming from a client, it will be received by the nginx and then it will be forwarded to the application server which is Puma over there beacause Nginx doesn’t know anything about Rack, or Ruby.That’s why we need Puma or any other Rack-compatible web server.&lt;/p&gt;

&lt;h4&gt;
  
  
  c. In Development why can't we use Webrick instead of puma???
&lt;/h4&gt;

&lt;p&gt;So the answer is we can use but, by default Webrick is single threaded, single process. This means that if two requests come in at the same time, the second must wait for the first to finish there our app getting slow so to tackle this situation in Rails 5 we are using Puma which is multi threaded and can process the multiple requests concurrently, which usually results in less memory usage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cDV7GSpm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eu8w7ndv3l6x06jw9ztn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cDV7GSpm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eu8w7ndv3l6x06jw9ztn.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So these are the examples of Web server, app server and frameworks used when you are creating an Ruby on Rails Web applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Middleware
&lt;/h2&gt;

&lt;p&gt;In Rails by default the middle ware is "Rack".&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rack provides a minimal, modular, and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Single Method Call&lt;/strong&gt;&lt;br&gt;
A Rack application is a Ruby object (not a class) that responds to call. It takes exactly one argument, the environment and returns an Array of exactly three values: status, headers, and body.&lt;/p&gt;

&lt;p&gt;You can write your own custom middleware or you can use 3rd party middleware services such as.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Red Hat JBoss Enterprise Application Platform (EAP)&lt;br&gt;
IBM WebSphere&lt;br&gt;
Oracle WebLogic&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  3. MVC Structure
&lt;/h2&gt;

&lt;p&gt;So if you are reading this then i assume that you are familiar with this but to summarise this , i will just brief what MVC is???&lt;/p&gt;

&lt;p&gt;So MVC stands for (Model view controller)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model:-&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Maintains the relationship between Object and Database and handles validation, association, transactions"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;View:-&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"A presentation of data in a particular format, triggered by a controller’s decision to present the data."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Controller:-&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The facility within the application that directs traffic, on the one hand querying the models for specific data, and on the other hand organising that data (searching, sorting) into a form that fits the needs of a given view.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  4. DB Server
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A database server is a server which uses a database application that provides database services to other computer programs or to computers, as defined by the client–server model&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;source:- &lt;a href="https://en.wikipedia.org/wiki/Database_server"&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for reading!!
&lt;/h3&gt;

&lt;h4&gt;
  
  
  If you have any questions or suggestions regarding this article, feel free to comment down below. ^_^
&lt;/h4&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Rails Migration Hacks !! Things You should know if you are a ROR Developer .</title>
      <dc:creator>Sambit Mohanty</dc:creator>
      <pubDate>Thu, 05 Mar 2020 12:59:42 +0000</pubDate>
      <link>https://dev.to/sambitmohanty954/rails-migration-hacks-things-you-should-know-if-you-are-a-ror-developer-2a1d</link>
      <guid>https://dev.to/sambitmohanty954/rails-migration-hacks-things-you-should-know-if-you-are-a-ror-developer-2a1d</guid>
      <description>&lt;p&gt;So here is my first post, before i start something let me give a brief summary about me. So i am a software engineer by profession and i am here to share experience which i have faced yet. so today our topic is "RAILS MIGRATION".&lt;/p&gt;

&lt;p&gt;If you are reading this then i assume that you are familiar with this term , what it is? and why we use it? so let's skip this part and move on.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. The way to create migration files???&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So the syntax for creating migration file is:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="n"&gt;migration&lt;/span&gt; &lt;span class="n"&gt;add_column_to_shops&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="ss"&gt;:string&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="ss"&gt;:text&lt;/span&gt;
   &lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="n"&gt;migration&lt;/span&gt; &lt;span class="no"&gt;AddColumnToShop&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="ss"&gt;:string&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="ss"&gt;:text&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;2. What if i want to change something in my migration file???&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So the correct way to do it is :-&lt;br&gt;
&lt;strong&gt;step - 1:-&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="ss"&gt;:migrate:down&lt;/span&gt; &lt;span class="no"&gt;VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20121212123456&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step - 2:-&lt;/strong&gt; &lt;br&gt;
&lt;strong&gt;change whatever you want to change inside change method, then save it&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AddDetailsToProducts&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;change&lt;/span&gt;
    &lt;span class="n"&gt;add_column&lt;/span&gt; &lt;span class="ss"&gt;:products&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:price&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:decimal&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;step - 3:-&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="ss"&gt;:migrate:up&lt;/span&gt; &lt;span class="no"&gt;VERSION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20121212123456&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Voillaaaa!!! the migration file got changed and it updates on schema file also .&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3. Is it okay if i delete the old migration???&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;So the answer is no, You should never change your old migrations. If you realised that given column is unnecessary, write a new migration to remove it.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you are working in a team, the fact that you removed the migration won't change your teammates' schemas. Even more, they have no migration to revert now!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. What is the datatypes we can write when we are declaring column name in migration file??&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="ss"&gt;:binary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:boolean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:decimal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:integer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="ss"&gt;:primary_key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="ss"&gt;:text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:time&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:timestamp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;source:- &lt;a href="https://guides.rubyonrails.org"&gt;https://guides.rubyonrails.org&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. If you by mistakenly done db:migrate then how to revert back???&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="ss"&gt;:rollback&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;will&lt;/span&gt; &lt;span class="n"&gt;revert&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;latest&lt;/span&gt; &lt;span class="n"&gt;migration&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="n"&gt;rake&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="ss"&gt;:rollback&lt;/span&gt; &lt;span class="no"&gt;STEP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt; &lt;span class="n"&gt;will&lt;/span&gt; &lt;span class="n"&gt;revert&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="n"&gt;migration&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;6. What are the change methods we can do it using rails migration???&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;a. Change Table Name:-&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChangeTableName&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;change&lt;/span&gt;
        &lt;span class="n"&gt;rename_table&lt;/span&gt; &lt;span class="ss"&gt;:old_table_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:new_table_name&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;b. Change Column Name:-&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChangeColumnName&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;change&lt;/span&gt;
        &lt;span class="n"&gt;rename_column&lt;/span&gt; &lt;span class="ss"&gt;:table_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:old_column&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:new_column&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;c. Create Table&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ChangeColumnName&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Migration&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;6.0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;change&lt;/span&gt;
          &lt;span class="n"&gt;create_table&lt;/span&gt; &lt;span class="ss"&gt;:contents&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
             &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt; &lt;span class="s2"&gt;"title"&lt;/span&gt;
             &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timestamps&lt;/span&gt;
          &lt;span class="k"&gt;end&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;d. Drop Table&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;      &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DropTableName&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Migration&lt;/span&gt;
        &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;up&lt;/span&gt;
          &lt;span class="n"&gt;drop_table&lt;/span&gt; &lt;span class="ss"&gt;:table_name&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;

        &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;down&lt;/span&gt;
          &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;IrreversibleMigration&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;So these are the basic change methods what we do in our daily basis, there is many more change methods but usually these 4 are used in professional level. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Bonus Tips&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If You are using rails engine in your project then how to copy migration file from rails engine to your main app???&lt;br&gt;
.&lt;br&gt;
think????&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
think again???&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
So you have to add this magic command in your main app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight ruby"&gt;&lt;code&gt;   &lt;span class="n"&gt;rails&lt;/span&gt; &lt;span class="n"&gt;engine_name&lt;/span&gt;&lt;span class="ss"&gt;:install:migrations&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;that will do the trick.....&lt;/p&gt;

&lt;p&gt;So that's it for today. If i miss something from rails migration section, please let me know in comment section.&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
