For Mac occasions:Which Ruby-"/usr/bin/ruby-" This is the Ruby that comes with Mac, and we want to be able to manage the Ruby version.Installing RVMCurl-l https://~/.profileCheck install ruby conditionRVM RequirementsStatus 1 is wrong." $ (curl-fssl https://raw.githubusercon
View
View is divided into builder mode and rhtml mode.
The following is an example of the builder mode.
XML. Div (: class => "productlist") DoXML. timestamp (time. Now)@ Products. Each do | product |XML. Product doXML. productname (product. Title)XML. Price (product. Price,: currency => "USD ")EndEndEnd
If the tag and built-in method are repeated, you can use something! () To generate tags
Rhtml is similar to JSP.
The H method provides HTML EncodingHelper
Xxxcontroller correspon
Lin Shi, a friend of mine, recommended a web development tool: Ruby. He went to his side in the morning and demonstrated it. It was amazing! As long as you define a database table, regardless of ms SQL and MySQL, the rest of the work is about the rails framework. Let's take a look at the self-contained page of the rails framework. One word can be used to describe
Deploying Network application Services is a hassle, installing programs, upgrading database schemas, switching versions, and restarting services. The more steps, the more human involvement, the more prone to problems.
Capistrano is Ruby on Rails to provide the deployment solution, the original name Switchtower, a lot of names, the results and people heavy, replaced now this, it is estimated to be in order
In the previous Ruby on Rails development from scratch (Windows) (iii)-Implementation of the jump between pages, we created two pages for the jump migration, this time we write a single form of maintenance of the TIM Delete Check the example.
1. This time we recreate a project depot, and follow the steps in the previous article to create a depot project.
2. Create a database.
You can use the
In the practice of agile development, the test drive is indispensable. This article looks at a test-driven development example in rails.
Before we wrote and conducted some unit tests and functional tests, our customers suddenly asked to add a feature: Each user of the system could query the product.
We first sketched some sketches to sort out our ideas and designs, and then we started writing code. We already have a general idea of what to do, but i
After several days, the Ror environment was finally ready. In order to prevent future forgetting and minimize detours, we made a special record
========================================================== =====
Installation Process
1. Install rubyinstaller-1.9.2
2. install and execute gem install rails
3. Download dev kit and decompress it to the ruby installation directory.
4. Install Netbeans 6.9.1
5. Enabl
Http://www.songlin51.com/archives/667.html
Ubuntu 12.04 redmine2.1 installation record
When you install gem install rails, you cannot connect to rails.
Solution: Search for railson http://rubygems.org/gems/railsto download rails. gem for installation.
An error is reported when installing gem install mysql2.Building native extensions. This cocould take a while
Let's take a look at some tips for debugging this time.
First, and most importantly, writing test code, writing unit tests and functional tests in rails is simple, using them to reduce the rate of bugs, or to avoid bugs in your previous code.
The test code tells you what works and what doesn't, and the test code helps you isolate the problematic code, because sometimes the bug doesn't show up quickly.
If the problem occurs in a model, we can use th
A Brief Introduction to Ruby on Rails's support for PostgreSQL array types, railspostgresql
I am very happy to announce that Rails 4.0 now supports PostgreSQL array types. you can easily create fields of the array type through: array => true in migration. you can also add other options (length, default, and so on) when creating an array field)
create_table :table_with_arrays do |t| t.integer :int_array, :ar
Modify viewsModify the index view (app/views/posts/index.html.erb) and add the edit link as follows:That is, add the following logic: Among them, Edit_post_path, is the previous "[Ruby on Rails] and I learned route map" referred to the edit action prefix added a shortcut after the _path suffix, can accept parameters, here accept the post instance object.Then edit the view and copy the new view as an edit v
Using form to create data, this section will cover the content: Create form, redirect user, render views and flash messages.1. Views PreliminaryEdit App/views/posts/index.html.erb This view file as follows:New_post is the new action's prefix, referring to [Ruby on Rails] and I learned the route map, but after it added the _path suffix.Then edit the App/views/posts/new.html.erb view file as follows:2. Bindin
user model that contains first_name, last_name, nickname, where the nickname field is an array type. The following migration code creates the corresponding table:
Create_table:users do |t|
T.string:first_name
t.string:last_name
t.string:nicknames,: Array => true
end
And for this table, we have a simple model
Class User
We do not use the default value for the field, if we instance a user object, the code is like this.
John = User.create (: first_name => ' J
Up to now, should come to an ending, altogether has 29 essays, simply gather together an integer, then write the IDE environment. All the previous code was written by me with the editor scite in Ruby, and it was inconvenient, as rails developed, there are many Ides coming out, just to see the 6.0RC version of NetBeans offering a separate rails development environ
The essay briefly understands the use of rails ' test and test data, and this time to see how to add a test to a model for deletion and modification.
1. Or using the last written products_test.rb, modify the Test_turth method by the name Test_create and make the contents:
def test_create
assert_kind_of Product, @product
assert_equal 1, @product. ID
assert_equal "pragmatic Ver Sion control ", @product. Title
assert_equal" I to use version control ",
Active support is a set of libraries provided with rails, active support extends some of the classes in Ruby, and this time we'll look at some of the most common features.
1. Extension of the number type
The Fixnum class adds two methods: even and odd?
The scaling method is also added:
Puts 20.bytes #=> 20
Puts 20.kilobytes #=> 20480
Puts 20.megabytes #=> 20971520
Puts 20.gigabytes #=> 21474836480
P
I mainly use two plug-ins: rinari and Yari.
Rinari supports fast jump to multiple files in the rails project. In addition, it provides the grep tool, which I found useful. The shortcut keys are easy to remember.
Yari provides an Emacs interface for the RI tool that comes with Ruby, which is compatible with the latest Ruby and easy to operate. You only need to u
Ruby rails installation process description 1. create a user 2. assign permissions first add a user group: groupadd humou Add User, set the main directory, shell path useradd-g humou-d/home/humou-s/bin/bash-m humoushell path is not set, this user will not be able to log on or directly: useradd-g humou set password passwd humou delete a user: userdel humou corresponding user group will also be deleted to vi
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.