Links
<% link_to 'Name', name_path(:param=> 'variable'), :class => 'css' %>Redirection
In Controller -> redirect_to name_pathIn Views ->
<% if developer_signed_in? %>
<script type="text/javascript">
window.location.href="/dashboard" // put your correct path in a string here
</script>
<%else%>
Killing process in Linux
ps aux | grep (process name)kill processID
Make Devise Authenticable to controller classes
class YourController < ApplicationControllerbefore_action :set_unlock_code, only: [:show, :edit, :update, :destroy]
#Only signed in user can do the following (Devise)
before_filter :authenticate_developer!
end
Parsing Form tag with parameters
Unlike form_for tag, this tag pass the values with params
<%= form_tag generate_codes_path, :class => 'form-inline' do %>
<div class="form-group"> <%= number_field_tag 'unlock_code[strAppId]', nil, :placeholder => 'App ID' %> </div>
<div class="form-group"> <%= number_field_tag 'unlock_code[batchNo]', nil, :placeholder => 'Batch No' %> </div>
<div class="form-group"> <%= text_field_tag 'unlock_code[strStatus]', nil, :placeholder => 'Status' %> </div>
<div class="form-group"> <%= number_field_tag 'unlock_code[priceUniversal]', nil, :placeholder => 'Price in USD' %> </div>
<div class="form-group"> <%= number_field_tag 'unlock_code[priceMMK]', nil, :placeholder => 'Price in MMK' %> </div>
<div class="form-group"> <%= number_field_tag 'unlock_code[num]', nil, :placeholder => 'Number of codes' %> </div>
<%= submit_tag 'Generate', :class => "btn btn-primary md-trigger" %>
<% end %>
In the controller tag
strAppId = params[:strAppId]
batchNo = params[:batchNo]
strStatus = params[:strStatus]
priceUniversal = params[:priceUniversal]
priceMMK = params[:priceMMK]
num = params[:num]