Tag:ruby-on-rails

  • Tutorial on Automated Deployment of Ruby on rails in docker

    Time:2022-4-2

    Basic rails applications Now let’s launch a basic rails application. For better demonstration, I use ruby 2.2.0 and rails 4.1.1 Run at terminal: ? 1 2 $ rvm use 2.2.0 $ rails new && cd docker-test Create a basic controller: ? 1 $ rails g controller welcome index … and edit routes RB so that […]

  • How to use redis store on Ruby on rails

    Time:2022-3-29

    Redis store is a toolkit designed for Ruby applications. It natively supports fragmentation, master-slave replication, marshalling, timeout and namespace. In addition, inRuby on RailsIt is also very simple to use on. How to use:For using redis store on rails, first we need to add an entry in the gemfile file   ? 1 2 gem […]

  • Configuring nginx + Ruby on rails + MySQL on Linux system

    Time:2022-3-12

    Install RVM RVM or rbenv is usually used to install ruby. RVM is selected here. ? 1 $ curl -sSL https://get.rvm.io | bash -s stable Load RVM: ? 1 2 3 $ source /home/libuchao/.rvm/scripts/rvm $ rvm -v rvm 1.25.12 (stable) by Wayne E. Seguin <[email protected]> …… Then execute the following command: ? 1 2 3 […]

  • A concise guide to quickly installing Ruby on rails

    Time:2022-3-8

    For new developers, how to install ruby, the running environment of ruby gems and rails may be a problem. This page mainly introduces how to quickly install Ruby development environment in a reliable way.This installation method is also applicable to the product environment! system requirements First, determine the operating system environment. It is not recommended […]

  • Some suggestions on Ruby on rails routing configuration

    Time:2022-2-20

    When you need to add one or more actions to a restful resource (do you really need it?), Using member and collectionroute。 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #Poor get ‘subscriptions/:id/unsubscribe’ resources :subscriptions   #OK resources :subscriptions do  get ‘unsubscribe’, on: :member end […]

  • Detailed explanation of activeresource usage in Ruby on rails

    Time:2022-2-18

    When the HTTP response is in a format different from the existing format (XML and JSON), some additional format parsing is required to create a format you prefer and use it in the category. The customary format should implement the following methods: extension, mime_ type,Encode and decode.      ? 1 2 3 4 5 6 […]

  • Some considerations during Ruby on rails migration

    Time:2022-2-17

    Put schema RB is saved under version control.Use rake DB: scheme: load instead of rake DB: migrate to initialize an empty database.Use rake DB: Test: prepare to update the schema of the test database. Avoid setting default data in the table. Use model layer instead. ? 1 2 3 def amount  self[:amount] or 0 end […]

  • Some suggestions on writing Ruby on rails views

    Time:2022-2-16

    Don’t directly fromviewCall the model layer.Don’t construct complex formats in the view, output them to a method or model of the view helper.Use partial templates and layouts to reduce duplicate code. Add client side validation to the usual validators. The steps to be done are: Declare a custom validator from clientsidevalidations:: middleware:: base        ? […]

  • Explain the use of mailer in Ruby on rails

    Time:2022-2-14

    Name mail something mailer. Without the mailer root, you can’t immediately show which is a mailer and which view is related to it.Provide HTML and plain text view templates. Failed to enable mail in your development environment, sending error. These errors are disabled by default. ? 1 2 3 # config/environments/development.rb   config.action_mailer.raise_delivery_errors =true Using […]

  • Explain the use of cube in Ruby on rails

    Time:2022-2-13

    Mark your unfinished scenes with the @ WIP tag. These scenarios are not considered and are not marked as test failures. When an incomplete scenario is completed and the functional test passes, the @ WIP tag should be removed in order to add this scenario to the test suite.Configure your default configuration file and exclude […]

  • Research on some methods to optimize the performance of Ruby on rails

    Time:2022-2-5

    1. Cause yourRailsThere are two reasons why applications slow down: Should not beRubyAnd rails as the preferred place to use Ruby and rails. (doing something you’re not good at with ruby and rails) Excessive memory consumption leads to the need to use a lot of time for garbage collection. Rails is a pleasant framework, and […]

  • Ruby on rails realizes payment on Ping + + platform

    Time:2022-1-29

    Create an order table from the local database. It is recommended to include the following fields. Refer to the official API( https://pingxx.com/document/api#api -c-new): order_no:required ? 1 2 3 4 5 6 7 8 9 10 The merchant order number, which adapts to the requirements of each channel for this parameter, must be unique in the […]