ruby
Ruby is python but with slightly different syntax
ruby &:
ar.map(&:reverse)
ruby for programmers
irb(main):001:0> "Hello World"
=> "Hello World"
ruby
this is my application_controller.rb file
private
def default_url_options
{ locale: I18n.locale }
end
def set_locale
I18n.locale = extract_locale || I18n.default_locale
end
def extract_locale
parsed_locale = params[:locale]
I18n.available_locales.map(&:to_s).include?(parsed_locale) ? parsed_locale.to_sym : nil
end```
This is my route.rb file
scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/ do
get 'careers' => 'pages#careers', :as => :careers
end
ruby |=
# When working with arrays |= is useful for uniquely appending to an array.
>> x = [1,2,3]
>> y = [3,4,5]
>> x |= y
>> x
=> [1, 2, 3, 4, 5]
ruby for programmers
irb(main):003:0> 3+2
=> 5
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us