project documentation :: sunrise app - sunrise order form

 Project Documentation :: Sunrise Order


.............................................................................................................................................................



Project Received :: 28 Apr 2021

Project Completed :: 30 Apr 2021


Older Ruby Version :: 2.3.1

Older Rails Version :: 3.2.14



Newer Ruby Version :: 3.0.1

Newer Rails Version :: 6.3.1.1


.....................................................................................................................................


Steps Followed during the Process ::


A Run the Previous Project with before Versions

B bundle with ruby (updated given version)

C bundle with rails (updated given version)

D rake db:create

E rake db:migrate

F dump import file

G Run the project after error

.....................................................................................................................................


Errors that Comes in the Project and Process that follows for that ::

.....................................................................................................................................


Bundle with ::


Change the Version


Command that run with final change in gemfile dependencies


01 : rvm install “ruby -3.0.1”

02: gem install bundler: 1.17.3

03: rerun bundler using ‘bundle 1.17.3 install’

04: sudo apt install rerun

05: Comment this file in the application.rb # require "active_resource/railtie"


Change the different dependencies with gemfile , and final work with this file

change / commment- uncomment the different versions of gemfile time to time and final get this code for successfully run the bunle with rails 6 given Version.

..........................


source 'https://rubygems.org'

# ruby '2.3.1'

ruby '3.0.1'

# gem 'rails', '3.2.14'

gem 'rails', '~> 6.1', '>= 6.1.3.1'

group :development do

gem 'activerecord-postgresql-adapter'

#gem 'charged', git: 'git@github.com:ion8/charged.git', branch: 'master'

gem 'pry-byebug'

gem 'pry-doc'

gem 'pry-rescue'

gem 'pry-rails'

end

group :production do

# TODO: needed for heroku. charged:heroku would be good

gem 'pg'

gem 'rails_12factor'

end

# Gems used only for assets and not required

# in production environments by default.

group :assets do

gem 'sass-rails'#, '~> 3.2.3'

gem 'coffee-rails'#, '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes

# gem 'therubyracer', :platforms => :ruby


gem 'uglifier', '>= 1.0.3'

end


gem 'jquery-rails'#, '~> 2.3.0'

gem 'activeadmin'#, '~> 0.6.6'

gem "bootstrap-sass", "~> 3.0.3.0"

gem "rails_layout", :group => :development

gem "dotenv-rails" # TODO: put it in charged:init


#gem "thin", group: [:development]

gem "unicorn-rails"

gem "unicorn"


gem "rspec-rails", "~> 2.14.0", :group => [:development, :test]

gem "capybara", "~> 2.1.0", :group => [:test]

gem "poltergeist", "~> 1.4.1", :group => [:test]

gem "factory_girl_rails", "~> 4.3.0", :group => [:development, :test]

gem "database_cleaner", "~> 1.2.0", :group => [:test]

gem "email_spec", "~> 1.5.0", :group => [:test]

gem "cucumber-rails"#, "~> 1.4.0", :group => [:test], :require => false

gem "guard", ">= 2.2.2", :group => [:development], :require => false

gem "guard-livereload", :group => [:development], :require => false

gem "rack-livereload", :group => [:development]

gem "rb-fsevent", :group => [:development], :require => false

gem 'delayed_job_active_record'

gem 'omniauth-google-oauth2'

gem 'country-select'

gem 'responsive_active_admin'

gem 'raygun4ruby'


.....................................................................................................................................


Error 01: Uninitialized Constant Devise


Sol : set devise gem in gemfile to compatible with rails 6

Sol: gem uninstall and install becrypt.


.................................................................................................................


Error 02: rake db:create :: config.eager_load is set to nil


Sol:

config/enviornments.rb ::

development.rb : set it to false

test .rb: set it to false (Unless you use a tool that preloads your test enviornment)

production.rb : set it to true


.................................................................................................................



Error 03: rake db:create :: SPRockets :: Railtie :: ManifestNeededError: Expected to find a manifest File in ‘app/assets/config/manifest.js’


Sol: Add this file and code inside it -


File :: app/assets/config/manifest.js

Code ::

//= link_tree ../images

//= link_directory ../javascripts .js

//= link_directory ../stylesheets .css


.................................................................................................................


Error 04: Rake db:create :: You should not use the match method in your router without specifying the http method.


Change this method via get and post - change the type of match method in route.rb with rails-6

match 'order/email/:id' => 'order#order_email_online', as: 'order_email' , :via => [:get, :post]


.................................................................................................................


Error 05: Rake db:create :: Undefined Method attr_accessible for AdminUser:Class.


Sol : Change the method with attr_accessor : In many files ::

sheet.rb, admin_user.rb, call.rb, contact.rb, line_item.rb, oder.rb,product.rb,quote.rb,setting.rb,base_importer.rb


.................................................................................................................




Error 06 : Rake db:create ::

Argument Error :: The Scope needs to be Callable :: Scope Error


In Product.rb


scope :active, -> { where(active: true) } Updated

# scope :active, conditions: { active: true }


scope :inactive, -> { where(active: false) } Updated

# scope :inactive, conditions: { active: false }


In Contact.rb


# scope :active, conditions: { active: true }

scope :active, -> { where(active: true) }


# scope :inactive, conditions: { active: false }

scope :inactive, -> { where(active: false) }



Error 07 : Rake db:create ::

Rails Exception on mass assignment protection for Active Record Models.


config/enviornments/test.rb :: Comment This Line ::

# config.active_record.mass_assignment_sanitizer = :strict



Error 08 : Rake db:create ::


Argument Error : The provide regular expression is using multiline anchors (^ or $),which may present a security risk.Did you mean to use /A and /Z or forgot to add the multiline => true option ?


In Product.rb : 12 :: Change regex to this type

:format => { :with => /\d{1,4}(\.\d{0,2})?/ }

Remove ^ and $ for security Reasons.


Error 09 : Rake db:create ::


Couldn ‘t create ‘sunrise_development’ database .Please check your configration

Change and update the database name and password In development , test and production.



Error 10 : Rake db:migrate :: Migration Error

Sol : Change the Migration file names in each migration and add [6.0]



Error 11 :Rake db:migrate :: Migration Error

rake db:drop

rake db:schema :load

rake db:create and rake db:migrate


Error 12 : Database Error : Dump Import File

Sol: First Download the File and then import it by the Command.

psql sunrise_development2 < /home/dwijendra/Downloads/latest.dump

psql -h localhost -d sunrise_development2 -U postgres -f /home/dwijendra/Downloads/latest.dump



Error 13: Run the Project :: rails s


undefined method ‘before_filter ’ for OrderController:Class


Replace before_action with before_filter in every file in the Project because we do not use the before_filter method in Rails.


Files: admin_user.rb , authorized_for_call.rb, authorized_for_order.rb, authorized_for_quote.rb, calls_controller.rb, order_controller.rb, quote_controller.rb,



Error 14: NoMethodError in Active Admin : : Devise :: Sessions# new

app/views/devise/sessions/new.html.erb


before : admin_user_omniauth_authorize_path(:google)

Updated : admin_user_google_omniauth_authorize_path


Error 15: Syntax Error :

Before buttons :

Did you mean button



Error 16: Stylesheet Problem – PopOver ::


css @import "active_admin/components/popovers"


@include global -reset


Solution: Resolve These Lines.




.....................................................................................................................................


If required will provide the available screenshots.


Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5