According to "Ruby on Rails" and I learned the route map, we know that can be accessed GET /posts/ :id (. :format ) to display specific objects.1. Modify the actionModify the APP/CONTROLLERS/POSTS_CONTROLLER.RB show this action. Here's a puzzle,
Ruby is an object-oriented programming language, which means the programming structure it operates on is called "object"
First go to the Code to understand the definition and usage of the class.
Class computer $ manufacturer = "Mango computer, Inc."
Sometimes, when you look at the source code, you can see that there is a
The parent class of the class is module, module. Methods. grep (/
The matched result set is: [: ,
E. gMoD Returns true ifMoDIs a subclassOther. ReturnsnilIf there's no
Focus on private and protectedPublic
The default value is public, which can be accessed globally.Private
C ++, "private" indicates "private to this class", but Ruby prefers "private to this instance ".In C ++, As long as class A can access Class A,
SELF: indicates the current object or default object in ruby. At any time of program execution, there is only one self.
1. Who is self and where is self?
To know which object is self, you must know the current context. The context mainly includes
Method calls in ruby are allObject. MethodSo how to find this method for the object?
First, you must understand the concept of the ancestor chain. The ancestor chain starts from a class to its parent class, and then to the parent class of the parent
In the previous article, we talked about callable objects proc and Lambda in Ruby. They are all block-converted objects. There are methods for calling objects in ruby. You can obtain a method object by using the method and using the method name as
The supplemental version of ruby-based watir automated test Note 1 adds some special control capture methods. Updating ....
Attribute_value
Obtains the properties of the current control.
Value = ie. Link (: Id => 'xxx'). attribute_value ("href ")
In Ruby, callback and hook methods are called when a specific event occurs. There are several types of events:
Call a method that does not exist.
Class mixing includes a module
Define subclass of A Class
Add an instance method to the class
Add
To install Ruby on Rails, first install Ruby, then install devkit, and then install rails;
But when I installed Ruby, I directly installed rails, So I reported an error. I recorded the entire process in the order of my error routes so that people
I used IDE development when I learned rails a few days ago. I didn't feel how fast the efficiency of rails is. Today, I tried it through the command line and I was shocked. without writing a line of code, I actually completed a simple model of
Http://guides.rubyonrails.org/v3.0.8/action_controller_overview.html#the-flash
How to display the error message in controller on the page,
The Flash is a special part of the session which is cleared with each request. this means that values stored
Http://guides.rubyonrails.org/v3.0.8/action_controller_overview.html#the-flash
How to display the error message in controller on the page,
The Flash is a special part of the session which is cleared with each request. this means that values stored
A summary of Ruby's basic syntax and a summary of ruby's basic syntax
1. Keywords
Keywords cannot be used to define variables or constants, module, class, def, undef, defined ?, If, then, else, elsif, case, when, unless, for, in, while, until, next,
Range object learning notes and rubyrange learning notes in Ruby
Range is a class of Range objects. You can use the Range operator ".. "or"... ","... "The generated range object includes the start and end points,"... "The generated range object does
Jquery implements saving selected users, while jquery implements users
1 Introduction
Functional requirements:
1. Select the user interface and display it in a pop-up box.
2. Dynamic Loading of page options (department and user)
3. Save the selected
You can use Ruby to view the function source code in the command line.
To view the source code of the update_attribute function of ActiveRecord, a common method is to search for def update_attribute directly in the Rails source code. The Pragmatic
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.