validates :y, :presence => true, :numericality => true
validates :width, :presence => true, :numericality => true, :natural_number => true
validates :height, :presence => true, :numericality => true, :natural_number => true
+ validates :r, :presence => true, :numericality => true
# validates :caption, :presence => true
# validates :settings, :presence => true
</p>
<p>
+ <b><%= t_m 'Balloon.r' -%>:</b>
+ <%= @balloon.r %>
+</p>
+
+<p>
<b><%= t_m 'Balloon.caption' -%>:</b>
<%= h @balloon.caption %>
</p>
<th><%= t_m 'Balloon.y' -%></th>
<th><%= t_m 'Balloon.width' -%></th>
<th><%= t_m 'Balloon.height' -%></th>
+ <th><%= t_m 'Balloon.r' -%></th>
<th><%= t_m 'Balloon.caption' -%></th>
<th><%= t_m 'Balloon.settings' -%></th>
<th><%= t_m 'Balloon.created_at' -%></th>
<td><%= balloon.y %></td>
<td><%= balloon.width %></td>
<td><%= balloon.height %></td>
+ <td><%= balloon.r %></td>
<td><%= h(truncate(balloon.caption, :length => 12)) %></td>
<td><%= h(truncate(balloon.settings, :length => 12)) %></td>
<td><%= l balloon.created_at %></td>
<%= link_to 'speech_balloon_templates', main_app.speech_balloon_templates_path %>
<%= link_to 'license_groups', main_app.license_groups_path %>
<%= link_to 'licenses', main_app.licenses_path %>
- <%= link_to 'colors', main_app.colors_path %>
<%= link_to 'system_pictures', main_app.system_pictures_path %>
</div>
<%= yield %>
<%= link_to 'speeches', :controller => 'speeches', :action => :list %>
</td>
</tr>
- <tr>
- <td>
- <%= link_to 'colors', :controller => 'colors' %>
- </td>
- </tr>
</table>
フキダシテンプレート関連
<table>
<%= link_to 'system_pictures', :controller => 'system_pictures', :action => :list %>
</td>
</tr>
- <tr>
- <td>
- <%= link_to 'colors', :controller => 'colors', :action => :list %>
- </td>
- </tr>
</table>
</div>
y: Y
width: 幅
height: 高さ
+ r: 角度
caption: 様子
settings: 拡張データ
created_at: 作成
--- /dev/null
+class AddROnBalloons < ActiveRecord::Migration
+ def up
+ add_column :balloons, :r, :integer, :null => false, :default => 0
+ end
+
+ def down
+ remove_column :balloons, :r
+ end
+end
@balloon.y = 0\r
@balloon.width = 1\r
@balloon.height = 1\r
+ @balloon.r = 0\r
@balloon.should be_valid\r
end\r
it '上限データが通る' do\r
@balloon.y = 99999\r
@balloon.width = 99999\r
@balloon.height = 99999\r
+ @balloon.r = 99999\r
@balloon.should be_valid\r
end\r
end\r
@balloon.should_not be_valid\r
end\r
end\r
+ context 'rを検証するとき' do\r
+ it 'nullなら失敗する' do\r
+ @balloon.r = nil\r
+ @balloon.should_not be_valid\r
+ end\r
+ it '数値でなければ失敗する' do\r
+ @balloon.r = 'a'\r
+ @balloon.should_not be_valid\r
+ end\r
+ it '0なら通る' do\r
+ @balloon.r = '0'\r
+ @balloon.should be_valid\r
+ end\r
+ it '負でも通る' do\r
+ @balloon.r = -1\r
+ @balloon.should be_valid\r
+ end\r
+ end\r
context 'settingsを検証するとき' do\r
end\r
end\r