Prevents further modifications to obj. A
returning String.new do |item| item << user.first_name item << user.second_name if user.second_name item << user.family_name end
Take a look at the definition of this method:
def returning(value) yield(value) value end
3. Layout and content_for
Real good with rails.
Eighth book of Rails-style: layout and content_for
4. Text_field_tag and f.text_field
They exist separately in the action_view helpers in form_tag_helper.rb and form_helper.rb.
form_helper which should be said that the helper method used to generate a more suitable target active_record associated with the form, because a lot of the convenience convention.
Form_tag_helper using the form to generate a higher degree of freedom.
In any case, to avoid conflict of namespace.
When you send a message to an object, the object executes the first method it finds on its
Sham This is the machinist in the way of implementation. It should be noted that, if you want to capture are the class method, so you want to define a method self.method_missing.
class A VALUE = A.new // it will fail because when run this line, class A is not yet loaded. This is quite different with Java. end
8. Rspec describe
Eric asked me, rspec test describe XXXController what effect? After reading the source code in this way would have been written to test the spec of the sub-class category. Then it is one of the public methods you can call you.
9. Load_path, require, load, include
load_path the equivalent of java's class path
require the equivalent of java and load the import, but the load of each document will load conditions, and require only one load.
Does include for mixin.
Related Posts of Broken free weekly Rails (c)
[Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...
Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15
The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...
package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *
dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q
The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq
Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...
exception There is no Action mapped for namespace / and action name checkLogin. - [Unknown location] com.opensymphony.xwork2.DefaultActionProxy.prepare (DefaultActionProxy.java: 186) org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy ...