Tag:Rails
-
Building Ruby on rails development environment under CentOS7
1. Installation of RVM curl -L https://get.rvm.io | bash -s stable RVM is a command-line tool that provides management and switching of multi-version ruby environments, as well as different gemsets for project management. If SSH key is not generated, this step may fail, and the installation can be performed after the key is generated directly […]
-
Example tutorial on parsing JSON-formatted data in Ruby and Ruby on Rails
Ruby parses JSONRuby parses the Json example: json = ‘[“a”, “B”, “C”]’ puts “Unsafe #{unsafe_json (json).inspect}” # Output Unsafe [“a”, “B”, “C”] Ruby parses Json and parses the JSON string above into Array. Such a method is not safe, for example: json = ‘puts “Danger Will Robinson”‘ puts “Unsafe #{unsafe_json (json).inspect}” What should I output? […]
-
Summary of the basic directory structure of applications built by Ruby on Rails
When using rails new appName to generate Rails applications, we can view the directory structure of Rails applications through tree: directory structure Under the application directory, there will be 11 directories such as app, config, db, doc, lib, log, public, script, test, TMP and vendor, and 5 files such as config. ru, Gemfile. lock, Rakefile, […]
-
A Concise Tutorial on Building Ruby and Ruby on Rails Framework Environment
Installing Ruby and Upgrading RubyGems Tip: During installation in Ubuntu environment, sudo make and sudo make install can be used when prompting permission issues. 1.Ruby installation wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz \ && tar -xzvf ruby-1.9.3-p125.tar.gz \ && cd ruby-1.9.3-p125 \ && ./configure –with-openssl-dir=/usr/lib/openssl make && make install 2.Zlib support cd ext/zlib ruby extconf.rb –with-zlib-include=/usr/include –with-zlib-lib=/usr/lib make && […]
-
Understanding the Design Architecture of Ruby on Rails Framework in the MVC Way of Thinking
In rails, the whole process of sending a request (/ users) is as follows:1) Browser sends requests (/users)2) Rails routes route requests to users_controller’s index method3) User_controller calls User Model back to get all users4) User Model reads all users from the database.5) User Model encapsulates all users read from the database as Lists and […]
-
Talking about Rake and Database Data Migration Operation under Ruby on Rails
I don‘t know if you have any experience of migrating data into Migration files. I believe both old birds and novices have done this. In fact, it is not impossible to do so, but such practice will gradually introduce you some unnecessary troubles. It is generally believed that the contents of the db/migrate folder are […]
-
Basic Learning Course for Rack Middleware in Ruby on Rails
Rack is a framework between Ruby server and rack application. rails and Sinatra are built on rack and belong to rack application. Rack provides a standard interface for interacting with servers. The standard rack program is an object that can respond to calls. It can be an object, a Proc, a lambda or even a […]
-
Ruby on Rails Framework Program Connecting MongoDB
The installation of mongodb and the construction of ror project are introduced in the front. Now we will integrate them. 1. Create projects Rails active_record support is no longer used when creating projects rails new todo -O 2. We will use MongoMapper to drive MongoDB to Rails Edit GemFile to add the following gem”mongo_mapper” Then […]
-
A Simple Guide to Ruby on Rails Website Project Construction
Create Rails Project Create a regular Rails project that uses the following commands directly: rails new blog But in China, because the speed of connecting RubyGems is too slow, Rails defaults to use bundle command to download and install dependency packages from RubyGems after building the project structure. Eventually, it gets stuck because of network […]
-
A tutorial on Ruby on Rails to implement the most basic user registration and login functions
It’s very convenient to implement user registration and login functions in Rails, such as gem extension packages with full functionality such as Devise. You can also use Rails’s own has_secure_password from built-in. The following is an attempt to use has_secure_password to achieve user registration and login functions. Dead work Create projects: rails new user_login The […]
-
Configuration of Ruby on Rails Framework and RubyMine IDE Development Environment on Ubuntu
Fragmentation in the preparatory stage During the installation of virtual box, there are many pits for one reason or another. Pit 1,With regard to terminals, be sure to use the starter to open them After installing the virtual machine and entering the system, we will encounter the first pit, terminal software. It is recommended that […]