Posts

Showing posts from August, 2022

why git gutter is sued

 git gutter is used for  the  author of the different codes in the project  for this we installl the gitgutter in our projet  r sir know this 

routes vanished in rails

 when go to another branch and pull from master then master routes and data comes .... so whenever we will switch to our old branch then its all old routes will come 

create full databse of ayushi in our application

rails serialiers

 https://www.rubydoc.info/gems/active_model_serializers/0.1.0

connect action cable with your backend - self

 https://medium.com/@the.asantiagojr/how-to-setup-actioncable-with-a-rails-api-backend-1f1807c2d908 1 What is Action Cable? Action Cable  seamlessly integrates WebSockets with the rest of your Rails application . It allows for real-time features to be written in Ruby in the same style and form as the rest of your Rails application, while still being performant and scalable. https://samuelmullen.com/articles/introduction-to-actioncable-in-rails-5/

add type in array - in project builder - skoolfinance

  ............................................................................................................................................... ............................................................................................................................................... class AddExecuteOnToApprovals < ActiveRecord::Migration[6.0]   def change     unless ActiveRecord::Base.connection.column_exists?(:approvals, :execute_on)       add_column :approvals, :execute_on, :string, default: [], array: true     end   end end ............................................................................................................................................... def approval_params params.require(:approval).permit(:menu_id, :date_created, :approval_name, :description, :status, :rule_criteria_id,execute_on: []) end ..................................................................................................

how to call model in rails

 https://stackoverflow.com/questions/11139605/call-a-model-method-in-a-controller

add column in rails

  class AddEmailToUsers < ActiveRecord::Migration [ 5.0 ] def change add_column :users , :email , :string end end

Send email in rails - R sir - Run ck editor

0. Check the Mail ::::::::::::::::::::::::::::::::::::::::::::::::::::::::: open console - PostMailer.welcome_email.deliver_now ............................................................ 1. /bin.bash--login + rvm use 2.6.5  2.  rails -v 3.  Web packer error ::  nvm install v14.10.1 bundle exec rails webpacker:install 4.rails g scaffold Post description:text  or  rails g scaffold User name:string  email:string  description:text 5. add ck editor gem - link - https://github.com/tsechingho/ckeditor-rails 6. gem 'ckeditor_rails' + bundle  7.add js assets -  //= require jquery_ujs //= require ckeditor-jquery 8. add js in application.js - same as it is - require.jquery should be at the front  //= require jquery  //= require jquery_ujs  //= require ckeditor-jquery 9. add ckeditor template - application.html.erb ....................................................................................................................

how to add the condition in rails and no error give - how , :string, default: [], array: true

 , :string, default: [], array: true first change column_type to string from integer   1. add new migration    2. add condition in migration  class AddExecuteOnToApprovals < ActiveRecord::Migration[6.0]   def change     unless ActiveRecord::Base.connection.column_exists?(:approvals, :execute_on)       add_column :approvals, :execute_on, :string, default: [], array: true     end   end end 3. set enum in model for string with add_array condition ::  self.table_name = :approvals # enum execute_on: [:record_creation, :record_edit] enum status: [:approved, :not_approved] enum execute_on: { "record_creation" => "record_creation", "record_edit" => "record_edit" }

ror questions

  agar apko api mein projects banane hain toh rails assets lagane ki jarurat hai    can you run two migrations at same times run or not and if yes then waht happen   polymorphic and asspcoatopm  is there any multiple tables in inehitance table  what is active record relation and active record association diff between include and join 

rename column in rails

  class ChangeUsersNameToTitle < ActiveRecord :: Migration [ 6.0 ] def change rename_column :users , :name , :title end end ## Rename column method rename_column ( :table_name , :column_name , :new_column_name )

change column type in rails with example

  class ChangePhoneToBeStringInCustomers < ActiveRecord :: Migration [ 5.0 ] def up change_column :customers , :phone , :string end def down change_column :customers , :phone , :integer end end The code we need to add takes the form of change_column :table_name , :column_name , :new_type In our case it would be something like change_column :customers , :phone , :string The completed file will look like this class ChangePhoneToBeStringInCustomers < ActiveRecord :: Migration [ 5.0 ] def change change_column :customers , :phone , :string end end

install mongo db successfully in your laptop - best link

 https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04

Checkout problem ::

 $ git checkout master   ------  -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------  problem message -------  error: Your local changes to the following files would be overwritten by checkout: template-app/Gemfile.lock template-app/config/database.yml template-app/db/schema.rb Please, commit your changes or stash them before you can switch branches. Aborting  -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------   -------  solution ------ checkout gemfile.lock checkout schema.rb copy paste database.yml to some other place and th...

otp create task ::

 R sir ne condition lagayi hai :: yahan tak ki condition lagayi :: ...................................................................................................................................   otp.save           if params[:data][:type] == "login_with_otp"             if otp.class.name == "AccountBlock::SmsOtp"               account = AccountBlock::Account.find_by(full_phone_number: otp.full_phone_number)             else               account = AccountBlock::Account.find_by(email: otp.email)             end             token = BuilderJsonWebToken.encode(account.id)             # Delete OTP object as it's not needed anymore             otp.destroy             return rend...

add column name in serializer in object

 module BxBlockApprover   class ApproverSerializer < BuilderBase::BaseSerializer     include FastJsonapi::ObjectSerializer     attributes *[       :id,       :no_of_approvers,       :approver_account_ids,       :description,       :notify,       :role_id,       :account_id     ]      attribute :role do |object|       object&.role&.name     end        end end

change column in rails

  class FixColumnName < ActiveRecord::Migration def self .up rename_column :table_name , :old_column , :new_column end def self .down # rename back if you need or do something else or do nothing end end https://dev.to/neshaz/multiple-ways-to-change-database-column-in-rails-34m0

How to check react application with cors policy

Image
Task :: Check the Cors Policy error at live url and local url ::::::::::::::::::::: Note :: react mein simple login api ki application banai hai , ya pehle se bani ho ya fir git se ya kaheen se pull lo -  url by dharmendra -   https://git.heroku.com/reacstcrud.git  -yeh url clone nai hua tha fir skype se zipo file lekar usko extract kiya aur us par kaam kiya tha maine  note :: dharmendra ki prepared login api ko maine zip skype ke through liya aur fir usko etract kiya tha  1. take the react application recent  ..................................................................................................................................................... 2. we have to run this application at local portal host and at live portal host ::  local url :localhost:3001/bx_block_login/login live_url : https://hrms-finance.b91002.dev.us-east-1.aws.svc.builder.cafe//bx_block_login/login Note ::  1. We have to take these two url's from the postm...