setup do
#ここにコントローラのコードを書いてしまった
end
write meaningful entry
Rails Insideってブログがあります。
その名の通りRuby on Rails情報が載ってるサイトです。
この度、外部の記事提供者を募集し始めるとのこと。
I'm Handing Rails Inside Over To.. You! - Rails Inside
下記、提供記事のガイドラインから引用です。
一般的なブログを書く心得として使えそう。
最初のパラグラフをサマリにする、ってのは理系論文スタイルですね。
学術論文のメディアとしての洗練され具合は面白いです。査読制度とか。
その名の通りRuby on Rails情報が載ってるサイトです。
この度、外部の記事提供者を募集し始めるとのこと。
I'm Handing Rails Inside Over To.. You! - Rails Inside
下記、提供記事のガイドラインから引用です。
一般的なブログを書く心得として使えそう。
Some content guidelines:
* News, opinion pieces, event summaries, and link roundups all welcome.
* At least 3 paragraphs.
* At least 200 words. Ideally 220-280 for news, longer as necessary for tutorials or opinion pieces.
* At least one image - which we have the rights to run.. if you use a Creative Commons licensed image, please credit it appropriately.
* Nothing racist/profane/etc, sorry!
* Ensure that the first paragraph is in the 50~80 word range and summarizes (or at least properly introduces) the topic of the post. See existing posts for guidance.
* If something is more suited to RubyFlow or already exists on your own blog, post it on RubyFlow.
* Content should be new/fresh for Rails Inside initially, but you can post it to your own blog too afterwards, of course :-)
最初のパラグラフをサマリにする、ってのは理系論文スタイルですね。
学術論文のメディアとしての洗練され具合は面白いです。査読制度とか。
git commit --amendはpushしたらやっちゃダメ
commitに「やっぱり」をかけたい時、ありますよね。
そんな時はgit commit --amendです。直前のコミットにワークツリーの変更を後乗せして、さも元々そうだったかのように見せることができます。
さてそれをpushするときどうするか…。普通にやるとgitに怒られます。
そこで質問
How do I push amended commit to the remote git repo?
--forceをつければOKです。でも誰かが「やっぱり」前のコミットをベースに変更しているかもしれないから、やっちゃダメですって話。
何にせよ、多くの場合、「やっぱり」はよくない結果を生みますね。あと--forceも。
意思決定、合意形成はどこに行っても大事ってことで。
そんな時はgit commit --amendです。直前のコミットにワークツリーの変更を後乗せして、さも元々そうだったかのように見せることができます。
さてそれをpushするときどうするか…。普通にやるとgitに怒られます。
そこで質問
How do I push amended commit to the remote git repo?
--forceをつければOKです。でも誰かが「やっぱり」前のコミットをベースに変更しているかもしれないから、やっちゃダメですって話。
I actually once pushed with --force to git.git repository and got scolded by Linus BIG TIME. It will create a lot of problems for other people. A simple answer is "don't do it".
because if someone already got your changes, then when they try to pull again, it might fail.
何にせよ、多くの場合、「やっぱり」はよくない結果を生みますね。あと--forceも。
意思決定、合意形成はどこに行っても大事ってことで。
Labels:
git
タダで雇えるバーチャル師匠
ネット上の誰かを仮想メンターを「雇う」って話。
Recruit virtual mentors
これはいい方法です。(一方的に)師事してしばらく経ってある程度吸収すると、気に入らないところが出てくる。そこで考えればいいわけです。それまでは自分の知識とか感覚とかをパワーフィーディングできます。
To recruit a virtual mentor, first find someone whose success and ideas you respect. Second, find literally everything that they’ve written. Third, find everything in video that they’ve done. Finally, find all of their products or apps or books and get them too. Once you’ve consumed everything that they’ve produced, setup a google alert for them and read anything new as it comes out
[意訳]
まず、成功していて考えがリスペクトできる人を探す。次に、彼らが書いたものを全部見つける。そんで動画も見る。製品、本とかアプリも全部ゲット。
彼らの作ったもの全部をこなしたら、グーグルのアラート(google readerとかすね)をセットして、新しく出るを速攻チェックできるようにして、全部読む。
Recruit virtual mentors
これはいい方法です。(一方的に)師事してしばらく経ってある程度吸収すると、気に入らないところが出てくる。そこで考えればいいわけです。それまでは自分の知識とか感覚とかをパワーフィーディングできます。
Labels:
life
Rails 2.x.xでException Notifierが動かない時
Rails2.3.5アプリにException Notifierを入れました。
諸々設定して起動したのですがこんなエラーが。
調べてみると、Exception NotifierがRails 3に移行している影響みたいです。
Missing ExceptionNotifiable module with exception_notification plugin
なので、3系対応開始前のコミットを使えとのこと。特定のコミットを使うにはscript/pluginじゃないでgit submoduleを使います。
Git clone vs Git submodule
これで一つのリポジトリの中に他のリポジトリが持てます(言い方合ってますかね)。
素直にやってみます。
動いた♪
$ script/plugin install http://github.com/rails/exception_notification
諸々設定して起動したのですがこんなエラーが。
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant ApplicationController::ExceptionNotifiable (NameError)
調べてみると、Exception NotifierがRails 3に移行している影響みたいです。
Missing ExceptionNotifiable module with exception_notification plugin
なので、3系対応開始前のコミットを使えとのこと。特定のコミットを使うにはscript/pluginじゃないでgit submoduleを使います。
Git clone vs Git submodule
これで一つのリポジトリの中に他のリポジトリが持てます(言い方合ってますかね)。
素直にやってみます。
$ git submodule add git://github.com/rails/exception_notification.git vendor/plugins/exception_notification
$ cd vendor/plugins/exception_notification
$ git checkout -b rails2 e8b603e523c14f145da7b3a1729f5cc06eba2dd1
$ script/server -e production
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
** Erubis 2.6.5
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2010-01-29 17:56:33] INFO WEBrick 1.3.1
[2010-01-29 17:56:33] INFO ruby 1.8.7 (2009-06-12) [i486-linux]
動いた♪
Labels:
exception_notifier,
git,
Rails
Fakerとfactory_girlで偽物大量生産
適当なデータを作るときのお供に。
factory_girlと組み合わせて便利でした。
これが
こうなります!
適当なデータが入ってくれますねー
他にもメールアドレス、名前などいろいろFakeしてくれます。
実際はこんな風に使いました。
悪くないす。
http://rubyforge.org/projects/faker
Faker: Quick “Fake Data” Generation in Ruby
factory_girlと組み合わせて便利でした。
これが
Factory.define :message do |f|
f.title Faker::Lorem.sentence
f.body Faker::Lorem.paragraph
end
こうなります!
>> y Factory.build :message
--- !ruby/object:Message
attributes:
created_at:
body: Quasi ab fuga reprehenderit quia. Nostrum laud...(以下略)
title: Alias dolor velit ut et vitae magnam aut non.
updated_at:
recipient_id:
sender_id:
適当なデータが入ってくれますねー
他にもメールアドレス、名前などいろいろFakeしてくれます。
実際はこんな風に使いました。
@a_to_b = Factory.create(:message, :sender_id => @Aさん.id, :recipient_id => @Bさん.id)
@c_to_d = Factory.create(:message, :sender_id => @Cさん.id, :recipient_id => @Dさん.id)
悪くないす。
http://rubyforge.org/projects/faker
Faker: Quick “Fake Data” Generation in Ruby
Labels:
factory_girl,
ruby,
testing
Subscribe to:
Posts (Atom)
Author
Archive
Labels
- actionmailer (2)
- ActionView (2)
- activerecord (5)
- Ajax (1)
- apache (2)
- authlogic (2)
- awk (2)
- bash (4)
- block (1)
- cache (1)
- capistrano (1)
- crontab (1)
- Debian (1)
- deployment (1)
- design (2)
- design pattern (1)
- exception_notifier (1)
- factory_girl (2)
- firefox (1)
- flash (1)
- git (2)
- haml (1)
- html (1)
- javascript (5)
- jQuery (3)
- life (2)
- linux (3)
- lisp (2)
- mail (1)
- migration (1)
- mysql (2)
- Passenger (2)
- prototype.js (1)
- Rails (26)
- Rails3 (1)
- rake (1)
- restful_authentication (2)
- Rspec (3)
- ruby (10)
- rubygems (1)
- screen (1)
- script/console (1)
- Security (1)
- shouda (1)
- shoulda (3)
- subversion (2)
- sudo (1)
- tdd (1)
- testing (4)
- thunderbird (1)
- UI (1)
- unix (1)
- vim (3)
- work (1)
- xargs (1)
- xss (1)
- zsh (1)