Install and use bundler in Ruby to manage multiple versions of gem and rubybundler
With rbenv to manage a multi-version ruby environment, we also need a tool that can manage multiple versions of gem (such as rails), that is, bundler. The project background is not detailed, for more information, visit http://bundler.io/
Scaffolding is a very easy way to rails, some simple additions and deletions to check the scaffolding can be achieved, save us unnecessary trouble, so how to use rails scaffolding, today to explain.
. Specify port Start Rails project
Copy Code code as follows:
Ruby
This method is very suitable for traditional ipvs users:1. You can continue to use your usual Windows platform editor,2. It avoids running rails in windows.3. Learn from each other: Windows desktop + LINUX background.
Specifically:1. Deploy the rails application in the Linux environment of VMware.2. Install the samba service on Linux.3. Install the sshd service o
RVM is a command-line tool that provides the management and switching of a convenient, multiple-version Ruby environment.
https://rvm.io/
If you are going to learn ruby/rails, RVM is one of the essential tools.
All commands here are operated under user privileges, and any command is best not to use sudo.RVM Installa
The older version of the Will_paginate is based on the plugin method, which is installed as follows: Ruby Script/plugin install Svn://errtheblog.com/svn/plugins/will_paginate
The new version of Will_paginate has abandoned this practice, instead of using the gem approach, this article through the establishment of a foobar application to understand the use of will_paginate.
==============================
omitted
end
Do not use while/until condition in multiline while/until.
# bad while
x > 5 does
# body omitted
end
until x > 5 does
# omitted end
# good
When you have a single body, use the While/until modifier as much as possible.
# bad while
some_condition
do_something
'
# good
do_something while some_condition
The negative condition is
The new version of Will_paginate has abandoned this practice, instead of using the gem approach, this article through the establishment of a foobar application to understand the use of will_paginate.
==============================
C:\>rails foobar-d MySQL
C:\GT;CD Foobar
C:\foobar>ruby script/generate Scaffold Article title:string Content:text
Set up the dat
regular expressions in the if and while conditional declarations. For example, the following code fragment,
If the string contains text perl or Python, output a piece of information.
Puts "scripting language mentioned: #{line}" if line =~/perl| python/
You can use Ruby to replace all the places where Perl and Python appear.
Line.gsub (/perl| python/, '
Files in the same directory, such as/USR/LOCAL/RUBY/FOO.RB and/usr/local/ruby/bar.rb two files.If you are directly in the FOO.RB
Require ' bar '
A bar.rb error cannot be found at execution time.This is because the running
/home/oldsong$ ruby/usr/local/ruby/foo.rb
The BAR.RB is found in the L
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.