Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Pluginが広げるRailsの魅力

6,624 views

Published on

Ruby勉強会@札幌-5

Published in: Technology
  • Be the first to comment

Pluginが広げるRailsの魅力

  1. 1. http://noplans.org/product/t-shirt/
  2. 2. http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated
  3. 3. % ./script/plugin install http://svn.techno-weenie.net/projects/ plugins/acts_as_authenticated ( )
  4. 4. ./script/plugin install [URL]
  5. 5. % script/generate authenticated user account % rake db:migrate
  6. 6. http://localhost:3000/account/
  7. 7. http://localhost:3000/account/login
  8. 8. http://localhost:3000/account/signup
  9. 9. class ApplicationController include AuthenticatedSystem before_filter :login_from_cookie class MyController < ApplicationController before_filter :login_required before_filter :login_required, :only =>[:edit, :update]
  10. 10. <h3>Welcome user</h3> <% if logged_in? %> <p> Welcome, <%=h self.current_user.login %> </p> <% else %> <!-- login form goes here --> <% end %>
  11. 11. http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids
  12. 12. ./script/plugin install http://svn.viney.net.nz/things/rails/plugins/ acts_as_taggable_on_steroids ruby script/generate acts_as_taggable_migration rake db:migrate
  13. 13. class Post < ActiveRecord::Base acts_as_taggable belongs_to :user end p = Post.find(:first) p.tag_list.to_s # quot;quot; p.tag_list = quot;Funny, Sillyquot; p.save p.reload.tag_list.to_s # quot;Funny, Sillyquot; p.tag_list.add(quot;Greatquot;, quot;Awfulquot;) p.tag_list.remove(quot;Funnyquot;)
  14. 14. Post.find_tagged_with('Funny, Silly') Post.find_tagged_with('Funny, Silly', :match_all => true) User.find(:first).posts.tag_counts .map{|t| quot;#{t.name}(#{t.count})quot;}
  15. 15. class ActsAsTaggableMigration < ActiveRecord::Migration def self.up create_table :tags do |t| t.column :name, :string end create_table :taggings do |t| t.column :tag_id, :integer t.column :taggable_id, :integer t.column :taggable_type, :string t.column :created_at, :datetime end add_index :taggings, :tag_id add_index :taggings, [:taggable_id, :taggable_type] end
  16. 16. http://www.yotabanana.com/hiki/ja/ruby-gettext.html
  17. 17. # gem install gettext
  18. 18. $KCODE=’u’ require 'gettext/rails' init_gettext quot;examplequot; # po
  19. 19. lang=ko lang=ja msgid quot;messagequot; msgstr quot; quot; msgid quot;Message|Textquot; msgstr quot; quot;
  20. 20. http://d.hatena.ne.jp/secondlife/20070207/1170835130
  21. 21. http://www.yotabanana.com/hiki/ja/ruby-gettext-howto-ror.html
  22. 22. http://jpmobile-rails.org/
  23. 23. http://blog.netswitch.jp/articles/tag/rails_plugin
  24. 24. http://andworkspace.net/
  25. 25. http://agilewebdevelopment.com/plugins/top_rated
  26. 26. http://www.railsify.com/

×