- git checkout dev
- git pull origin dev
- git checkout -b <branch-name>
Follow some basic step to update rails version
1. Go to the Gemfile and replace older rails version to new rails version Like
gem 'rails', '5.2.5' gem 'rails', '6.1.4'
gem 'pg', '< 1.0.0' gem 'pg'
ruby '2.7.1'
2. After that Run bundle install
3. after that run this:- raile app:update
=> when we run this cmd I have to keep the changes of these all files which are given below :-
5. In this file Dockerfile.prod
FROM ruby:2.6.7-alpine as Builder FROM ruby:2.7.1-alpine as Builder
RUN gem install bundler:2.2.16 RUN gem install bundler:2.2.26
FROM ruby:2.6.7-alpine FROM ruby:2.7.1-alpine
go to this Url for reference :- https://github.com/pmdgithub/auth/pull/202/files
* You may also use the show-branch command for seeing the branches and their commits as
gem 'devise'
gem 'bootstrap', '~> 4.0.0.alpha3'
2. Run
$ bundle install
3.
Add Bootstrap’s styles: stylesheets/application.scss @import "bootstrap";
User
model,$ rails generate devise:install
$ rails generate devise User
$ rails generate devise:views
$ rails db:migrate
5. Now restrict access to all pages of the site to authenticated users only:
class ApplicationController < ActionController::Base
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up) {|u| u.permit(:email,:password,:password_confirmation,:first_name,:last_name,:company_id,:user_role_id,
:start_date,:end_date,:monthly_charge,:notes,:image,:active)}
devise_parameter_sanitizer.permit(:account_update) {|u| u.permit(:email,:password,:password_confirmation,:first_name,:last_name,:company_id,:user_role_id,
:start_date,:end_date,:monthly_charge,:notes,:image,:active, :current_password)}
end
end
6. Add this code to (Layouts/application.html.erb)
<% if user_signed_in? %>
Logged in as <strong><%= current_user.email %></strong>
<%= link_to 'Edit Profile', edit_user_registration_path, :class=>'navbar-link' %> /
<%= link_to 'Logout', destroy_user_session_path, :class=>'navbar-link' %> /
<% else %>
<%= link_to "Sign up", new_user_registration_path, :class=>'navbar-link' %> |
<%= link_to "Login", new_user_session_path, :class=>'navbar-link' %>
<% end %>
class User::RegistrationsController < Devise::RegistrationsController
#
# Other Codes
## To build the resource
build_resource(sign_up_params)
## Verifying Captcha
super
else
render 'new'
end
end
# Other Codes
end
Recaptcha.configure do |config|
config.public_key = 'Replace with your public key'
config.private_key = 'Replace with private key'
end
$ rails generate shopify_app
rake db:migrate
to add bundle exec rails server
SHOPIFY_API_KEY=your api key
SHOPIFY_API_SECRET=your api secret
These values can be found on the "App Setup" page in the Shopify Partners Dashboard.(when you create a account on shopify and after create a app then u get api key and api secret )install
generator, you can start your app with bundle exec rails server
and install your app by visiting localhost.ShopifyApp::SessionStorage
concern which adds two methods to make it compatible as a SessionRepository
. After running this generator you'll notice the session_repository
in your config/initializers/shopify_app.rb
will be set to the Shop
model. This means that internally ShopifyApp will try and load tokens from this model.rails generate shopify_app:controllers
generator then
this code gets copied out into your app so you can start adding to it.
Routes and views follow the exact same pattern.callback_path
/
in order to render the Enter your shop domain to log in or install this app.
/app/views/shopify_app/sessions/new.html.erb
file, you may also want to customize the URL entirely. You can modify your shopify_app.rb
initializer to provide a custom login_url
ShopifyApp.configure do |config|
config.login_url = 'https://my.domain.com/nested/login'
end
omniauth.rb
initializer:
provider :shopify,
ShopifyApp.configuration.api_key,
ShopifyApp.configuration.secret,
scope: ShopifyApp.configuration.scope,
per_user_permissions: true
The current Shopify user will be stored in the rails session at session[:shopify_user]
Online access
here. Note that this means you won't be able to use this token to respond to Webhooks. bin/rails g shopify_app:add_after_authenticate_job
invoke test_unit
create test/jobs/shopify/after_authenticate_job_test.rb
insert config/initializers/shopify_app.rb
Error adding after_authenticate_job to config. Add this line manually: config.after_authenticate_job = { job: "Shopify::AfterAuthenticateJob", inline: false }
create app/jobs/shopify/after_authenticate_job.rb
To configure the after authenticate job update your initializer as follows:Common Git Commands Take clone of a repository git clone <remote-repository-url> ex: git clone https://github.com/agricor/RegTech...