6.1 expression
Primary Expression
Numbers and strings are basic expressions.
Specific Keyword: True False nil self
The reference to variables is also a basic expression. The result of their evaluation is the value of the variable to which it
Around_filter: around_action_filter
Protected
Def transaction
Ret = true
Activerecord: Base. Transaction do
Begin
Yield if block_given?
Rescue exception => ex
Set_notice (ex. Message)
Ret = ex. Message
Raise activerecord: rollback,
Using built-in database functions in Ruby to call orcale database is more troublesome, but fortunately the Open Source of the East expansion is very good, we can use the open source components of ruby-oci8 to orcale database for a series of
The ruby method can accept code blocks as parameters, which is a very flexible method and a very good design idea. Suppose there are three methods as shown in 1:
Figure 1
As shown in figure 1, a large number of code blocks of method A, Method B, and
It has been more than two months since I started to learn Ruby language dependencies. I feel that I have never gained a lot. I even read all the ruby language learning tutorials, however, there is always a sense of no way to start.
Ruby can also
Use couchrest_model:
Https://github.com/couchrest/couchrest_model
1. Modify gemfile and add:
gem 'couchrest_model'
Then run bundle install.
2. Run
rails generate couchrest_model:config
Generate the couchdb. yml file in the config directory,
Then
Read "Open Source Base Camp" to see this section. Just give it a try.
First, go to the Internet to down the installation files to be used, as shown below:Http://rubyforge.org/frs/download.php/12751/ruby185-21.exeHttp://rubyforge.org/frs/download.php/
In the university, a book is often placed in the course seat the night before, indicating that the position has been occupied. The next day, I came to this seat and opened the book for formal classes. in this phenomenon, Books Act as
I recently read the basic syntax section of [ironruby unleashed feb.2010] and found that "use a different..." appears in many places in the book.
Indeed, many basic operations in Ruby provide many methods/aliases, and many odd syntax (sugar ). In
Restful embodiment ---- Resource
Of course, it seems quite narrow to put restful and resource together. In rails, actioncontroller: Resources abstracts resources in rest. Here, I will not talk about the concept of rest, A huge amount of online
Use will_paginate for paging and simple query
Run the gem install will_paginate command on the command line. The following result shows that the installation is successful.
Open books_controller.rb (your own Controller)
Comment out all the methods
Development Environment
RUBY: ruby1.9.1
Rails: rails2.3.5
MySQL: mysql5.0.9
Driver: mysql-2.8.1-x86-mingw32.gem
IDE: rubymine2.0.1
1. Create a data table users
Use the scaffold tool that comes with rubymine to create a data table users. You can
Chinese garbled characters:
1. The. html. ERB file in the viewsdirectory directly writes Chinese characters and displays garbled characters in the browser.
2) The Chinese characters saved to the MySQL database are displayed normally on the
This example is based on Ruby ruport practice-simple report system and Ruby ruport practice-Chinese PDF report prawn, and adds the design and implementation of report parameters.
1. Create a data table report_parameters
Create Table
Development Environment:
RUBY: ruby1.9.1
Rails: rails2.3.5
IDE: rubymine2.0.1
Flex builder: Flex builder4
Development ideas:
1) create a flex project in flex Builder
2) create a rails project in rubymine
3) Copy swfobject. js compiled under the
Document directory
Ruby class
Class inheritance
Polymorphism
Dynamic Language
Encoding
Ruby class
The first letter is capitalized. The instance variable name starts with @, and the method name and parameter name start with a lowercase
Development test cases)1. Open the editor2. Use. RB as your file extension3. Write "require 'watir'" in the first sentence of the test file to ensure that the watir tool is accessible.4. Open the browser and go to the application to be
Ruby development configuration method:1. Before you start using Ruby, you must install (or verify that you already have) the Ruby interpreter and library, and Ruby development environment. Download: ruby186-25.exe2. Download the Eclipse plug-in:
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service