This is the first episode in a series covering Rails 3.1. Here I show how to install the beta and show some of the new features.
2012年10月29日19:27 Ruby Rails3.1から導入されたAsset Pipelineがよくわかってなかったから調べた Asset PipelineというのはRails3.1から追加された機能で、以下のような特徴を備えています。なかなか便利そうなやつです〜。 ・cssやjsは各々一つのファイルにまとめられる(ブラウザのリクエスト回数を減らせる) ・それらのファイルは自動で圧縮/難読化される(ファイルサイズを減らして負荷軽減) ・ついでに、SassやCoffeeScriptを使ってcssやjsを記述することが可能になっている ではどういった仕組みなのか見てみましょう。 例えばRails3.2.3で新しいアプリを作成したとします。このとき、Gemfileにはデフォルトでjquery-railsが指定されています。そしてapp/assets/javascripts/applica
279: Asset Pipelineを理解する (view original Railscast) Other translations: Other formats: Written by Naomi Fujimoto Asset PipelineはRails 3.1のもっとも大きな新機能ですが、同時にもっとも混乱しやすい機能でもあります。今回のエピソードでは、このAsset PipelineがどのようにRailsアプリケーションのアセットを管理するかを見ることによって、少しその神秘性を取り除いていきたいと思います。もしAsset Pipelineについてまったく知識がない場合は、Rails GuideのAsset Pipelineのページが多くの機能を説明しているので、まずそこから始めるのがいいでしょう。 Rails 3.1アプリケーションを書いたことがある方なら、http://
新年あけましておめでとうございます。2012年初投稿です。 実は 2012/01/10 より、見習いとしてではありますが、 SonicGarden へ入社することになりました。 今まで応援下さった皆々様、本当にありがとうございます。 まだひとつのミッションをクリアしただけで、これからが頑張りどころです。 これからもどうぞよろしくお願い致します。 Rails アプリを Heroku へデプロイするミッション さて、Ruby on Rails 修行の一環で、Rails アプリを Heroku へデプロイすることになりました。 ↓の @mat_aki 先生の記事を参考にします。 参考 : Herokuで作るFacebookアプリ:第2回 HerokuでRailsアプリを動かそう|gihyo.jp … 技術評論社 POINT 先にうまく行く要点を。 結果、最終的な環境は ruby 1.9.2p29
pelle/oauth-plugin - GitHub 事前準備 oauth-plugin はコントローラーに current_user, current_user=, logged_in?, login_required の4つのメソッドがあることを前提としていますので、自分のプロジェクトの設計にあわせてこれらのメソッドを作りましょう。 current_user 現在ログインしているユーザーのユーザーモデルインスタンスの getter current_user= 現在ログインしているユーザーのユーザーモデルインスタンスの setter logged_in? ログイン状態の場合は true, 未ログイン状態の場合は false を返す login_required 未ログイン状態でログインが必要なページ(OAuth Consumer の登録ページなど)にアクセスした際の処理(典型的には、ロ
方針 手元(Ubuntu)で開発して、サーバ(Ubuntu)にデプロイ出来るrails 3.1動作環境を作るのが目標 プロジェクト毎にユーザを作成する (各ライブラリをプロジェクト毎にbundlerで管理、デプロイをするため) 同様の理由でrbenvを使って各ユーザ毎にrubyのバージョンを管理 構成 静的なファイルへのリクエストは直接nginxで返す構成をとります(railsのpublic配下のディレクトリにあるファイル、適宜nginxのconfigに設定を追加する必要あり)。またrails3.1からAsset Pipelineが導入されたため/assets/〜に関するリクエストに関してもnginxで直接返すようにします。加えてnginx <=> unicorn間の接続にはUnix Domain Socketを用います。イメージを図にすると下記のようになります。 unicorn gith
Heroku で Rails 3.1 アプリを git push heroku master するとこんなエラーが出ることがあると思います。 -----> Preparing app for Rails asset pipeline Running: rake assets:precompile rake aborted! Failed to connect to a master node at localhost:27017 Tasks: TOP => environment (See full trace by running task with --trace) Precompiling assets failed, enabling runtime asset compilation Injecting rails31_enable_runtime_asset_compilati
Bootstrap in action, as demoed in Luca Pette's article Updated Feb 2012 for Bootstrap 2. Twitter’s new CSS toolkit, Bootstrap, is all the rage these days. I explain how to get the CSS, and optionally the mixins and the JavaScript, into your Rails app. “How do I serve Bootstrap through Rails 3.1’s asset pipeline?” Just add Ken Collins’s (@metaskill’s) less-rails-bootstrap gem (announced recently on
Highlights in Rails 3.1: Streaming Reversible Migrations Assets Pipeline jQuery as the default JavaScript library These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the changelogs or check out the list of commits in the main Rails repository on GitHub. 1 Upgrading to Rails 3.1If you're upgrading an existing application, it's a great idea
またまたRails 3.1 ネタです。Rails 3.1 では migration ファイルのデフォルトフォーマットが変わりました。 rails g model blog title:string body:text としたとき、Rails 3.0 では下記のファイルが生成されます class CreateBlogs < ActiveRecord::Migration def self.up create_table :blogs do |t| t.string :title t.text :body t.timestamps end end def self.down drop_table :blogs end end Rails 3.1 では下記のファイルが生成されます。 class CreateBlogs < ActiveRecord::Migration def change cr
Rails 3.1 からパスワードの暗号化用のモジュールができたようです。ActiveModel::SecurePassword で定義されていて、ActiveRecord や Mondoid などの ActiveModel を利用しているモデルで使えるそうな。 User モデルに password_digest カラムが設定されている前提で class User < ActiveRecord::Base has_secure_password end とすると、下記のような効能が得られます。 attr_reader :password validates_confrmation_of :password validates_ppresence_of :password_digest password に何か代入すると自動で bcrypt-ruby でハッシュにされて password_d
Riding Rails: Why HTTP Streaming?の意訳です。Rails 3.1 からHTTPストリーミングがサポートされるようになるらしい。 HTTPストリーミングって何? 普通の動的なHTTPレスポンスにはContent-Lengthヘッダが必要。時系列的にはこんな感じ HTTPリクエスト 動的なコンテンツの生成 HTTPレスポンス これらは三つの連続したステップとなる。普通はコンテンツを生成するとそのサイズを知ることが可能になり、レスポンスヘッダにContent-Lengthを付け加える。 HTTPは上記のやり方の代わりにchunked transfer encodingと呼ばれるストリーミング的なやりかたも提供している。 ストリーミングなレスポンスにはContnt-Lengthヘッダはない。その代わりにTransfer-Encodingヘッダが"chunked"とい
I’ve been working on revamping the Active Record query interface for the last few weeks ( while taking some time off in India from consulting work, before joining 37signals ), building on top of Emilio’s GSOC project of integrating ARel and ActiveRecord. So here’s an overview of how things are going to work in Rails 3. What’s going to be deprecated in Rails 3.1 ? These deprecations will be effecti
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く