Ruby
The command which -a ruby will show you where Ruby is installed.
which -a rubySave user and modify
u = User.find_by(email: "<EMAIL>")
# Then run commands like below
# u.access_locked = false
# u.access_locked?DB Dump Steps
# Create DB via PgAdmin App
pg_restore --port 5432 --username logeshpaul --dbname mdr_staging --no-password --verbose /Users/logeshpaul/Downloads/
.env file DATABASE_NAME_DEVELOPMENT=mdr_staging
./bin/dev
# Alternate Method shared by Lordson
psql DB_NAME < sce_dump.sqlTime
# current time
Time.now # 2009-06-24 12:39:54 +0900
# Return Time string with certain format - dd-Mon-yyyy HH:MM am/pm
"%d-%b-%Y %-l:%M%P" # 27-Jan-2016 7:19am
"%d/%m/%Y %-l:%M%P" # 27/01/2016 7:19amMore about Time API - Link
Changing the format of Date & Time
<%= Time.now.strftime("%m/%d/%Y") %>
<%= DateTime.now.strftime("%m/%d/%Y") %>
<%= DateTime.now.strftime("%e-%b-%Y %m:%M %p %Z") %>
# outputs - 12-Feb-2016 07:05 PM ISTIn case you want a custom format use Strftime
Populate projects and studies in sce
rake sycamore:dashboard:seed[1,1,50,50,50]Enable / Disable Form, Codelist, etc
rake app:admin:features:enable["Pharma","new_vrep"]
rake app:admin:features:enable["Pharma","new_standard"]Enable / Disabled Editor
rails c
a = Organization.last
a.ff_react_editor = true
a.saveClear local DB (Like prime for SCE)
rake db:setup db:test:prepareCreate fixtures in MDR
rails c
StandardFixtures.createRun Specs
Run all tests - bundle exec rake spec SPEC_OPTS="--format documentation"Run server in production environment
rails s -p 9000 -e productionAssets
rake assets:clean
rake assets:precompile
rake -TJobs
rake jobs:workRake DB Drop & Prime
rake db:drop db:create db:schema:load
rake db:dev:primePKPD
rake db:drop db:create db:schema:load
engines/pkpd/bin/simulate_deploy.sh
rake db:setupHelp
rake -T | grep primeRails Console
rails cContent tag contact
content_tag :li, class: css_class do
link_to(text, path, name: name) +
link_to('', "javascipt:void(0)", class: "CLASSNAME")
endSelenium Driver
Selenium Driver Config steps to test the feature/CSS styles layouts/JS features in action in Chrome browser: (This are just to see whats going in your spec)
Note: Please do not commit these configs
Add these to your application
Gemfilewithin Test group:
gem "selenium-webdriver"
gem "chromedriver-helper"Run
bundle installin terminal.In
spec/rails_helper.rbComment out line 54Capybara.javascript_driver = :webkitAdd below code in
spec/rails_helper.rbline 53:
Capybara.register_driver :selenium_chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
Capybara.javascript_driver = :selenium_chromeRun your individual feature spec and see them running in a new Chrome browser.
Adding Route
resources :tools do
collection do
get :run_now
end
end
<%= link_to t(".add_new_metadata_source"), run_now_study_tools_path(**@**study), remote: true, class: "”=%>Checking available routes
# All
rake routes
# Search routes
rake routes | grep <routename>Misc
rake tmp:clear
rails new projectname
bundle exec rails g controller homeLast updated