-
legacy wild controller route ':controller(/:action(/:id))(.:format)' は使わない派
-
利用するURLを明示しておきたい
-
named_route使えないとリンクの記述が冗長になるのでは
-
namespaceなど少し複雑なことをやろうとすると何かしらルーティングを書くことになり、統一感がなくなる
-
確認画面
- confirmアクションの追加
- 各アクションがすっきりする
- 新規と編集で挙動が変わる場合 (edit_confirmアクション?)
- confirmアクションの追加
-
パラメータ(mode=confirm)またはモデルの確認用プロパティ(http://bit.ly/mRQ8I5)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
# Provide access to helper methods from outside controllers and views, | |
# such as in Presenter objects. Rails provides ActionController::Base.helpers, | |
# but this does not include any of our application helpers. | |
def self.all_helpers | |
@all_helpers_proxy ||= begin | |
# Start with just the rails helpers. This is the same method used | |
# by ActionController::Base.helpers | |
proxy = ActionView::Base.new.extend(_helpers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
http://tddbc.doorkeeper.jp TDD Boot Camp 2013-07 -- TDDBC で、偶然にもロンドンから来日していたSteve Freeman氏を招くことができた。ちなみに本当に偶然の来日で、その日の夕方にご家族と隅田川の花火を見る予定だったらしい。貴重な時間である。
20分ほど講演していただき、さらに参加者と一緒にペアプロ課題に挑戦してもらった。しかもペアプロでっていう貴重な体験をさせてもらったので、そのことについてまとめたい。
Steve Freeman氏は書籍 "Growing Object-Oriented Software, Guided by Tests" (邦訳「実戦テスト駆動開発」)の共著者の一人で、Javaのモックフレームワーク "JMock"の開発者の一人。当然、自動販売機の課題にもJMockを駆使してモデリングしていただくことになった。
2014-07-09 それぞれ修正されたのを確認したので追記します。
APSB14-17 で修正されたようです
- http://helpx.adobe.com/security/products/flash-player/apsb14-17.html
- 14.0.0.145 または 13.0.0.231 以上であれば修正されています
- Safari + Flash Player 14.0.0.125 / 13.0.0.223 では sendToURLを使ってcross originでのカスタムヘッダ付与が出来るのを確認しています
筆者が把握している範囲で、最新版のFlash Playerを利用している場合に、(crossdomain.xmlもしくはユーザーの許可なしで)cross originでカスタムヘッダを付与する方法はありません。
Webサイト運営者は
- Assigning an object to a
belongs_to
association does not automatically save the object. It does not save the associated object either.
- When you assign an object to a
has_one
association, that object is automatically saved (in order to update its foreign key). - In addition, any object being replaced is also automatically saved, because its foreign key will change too
- If either of these saves fails due to validation errors, then the assignment statement returns false and the assignment itself is cancelled.
- If the parent object (the one declaring the
has_one
association) is unsaved (that is,new_record?
returns true) then the child objects are not saved. They will automatically when the parent object is saved.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original Rails controller and action | |
class EmployeesController < ApplicationController | |
def create | |
@employee = Employee.new(employee_params) | |
if @employee.save | |
redirect_to @employee, notice: "Employee #{@employee.name} created" | |
else | |
render :new | |
end |
This list is based on aliases_spec.rb.
You can see also Module: RSpec::Matchers API.
matcher | aliased to | description |
---|---|---|
a_truthy_value | be_truthy | a truthy value |
a_falsey_value | be_falsey | a falsey value |
be_falsy | be_falsey | be falsy |
a_falsy_value | be_falsey | a falsy value |
OlderNewer