Text of my 90 minutes lecture in Shimane Univ, learning web application through developing lucky-fortune application with Ruby on Rails. Most parts are written in Japanese.
The document discusses using Ruby to create domain-specific languages (DSLs). It provides examples of internal DSLs in Ruby, like Rails routes and migrations, which take declarative, natural language forms. The document encourages writing code in a DSL-like style by using declarative programming, blocks, and methods that represent special concepts. It also discusses how to structure code to express the "nature" or "essence" of a class through modules in a declarative way.
Pragmatic Patterns of Ruby on Rails - Ruby Kaigi2009Yasuko Ohba
This document discusses coding patterns for developing large and complicated Ruby on Rails applications. It recommends expressing business logic in models using object-oriented principles, following DRY, CoC and RESTful principles, and writing code in models' standard flows like find, new/save, find/update, and find/destroy. Filter methods are suggested to avoid duplicating code and improve readability. Moving branching logic based on parameters and other model processing code from controllers to models improves testability and reusability. Choosing natural coding styles for Rails that follow its core principles helps keep code maintainable for other developers. Sharing such pragmatic patterns is important for developing large codebases.
現地時間3月3日から10日にかけて、世界中のテレコムが注目するテクノロジーカンファレンスである「Mobile World Conference 2025」がバルセロナで開催されました。特に競争の激しいヨーロッパのマーケットでは、各社が生き残りをかけたイノベーションをたくさん生み出しています。5G/6G、エッジクラウド、新しい音声技術など、多くのキーワードが注目されています。
30. みなとRuby会議01
change
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do ¦t¦
t.string :name, :null => false
t.string :name_kana, :null => false
t.string :email, :null => false
t.string :password_hash
t.string :password_salt
t.timestamps
end
end
end 株式会社万葉
2012年6月4日月曜日
31. みなとRuby会議01
up & down
class RemoveNameKanaInUsers <
ActiveRecord::Migration
def up
remove_column :users, :name_kana
end
def down
add_column :users, :name_kana, :string
end
end
株式会社万葉
2012年6月4日月曜日
68. みなとRuby会議01
describe Project do
describe "#close" do
let(:proj) {Factory.create(:project, :closed => true)}
context "when closed" do
it {expect{proj.close}.to raise_error}
end
end
end
株式会社万葉
2012年6月4日月曜日