I was asked to present to a group of winery C-level about why they should care about Social Media marketing, and answer: "What are the three most important lessons you’ve learned about how the use of social media can boost the success of businesses in the wine industry?" and "What new trends and tools do you think will make a difference in your social media strategy in the future?"
I was asked to present to a group of winery C-level about why they should care about Social Media marketing, and answer: "What are the three most important lessons you’ve learned about how the use of social media can boost the success of businesses in the wine industry?" and "What new trends and tools do you think will make a difference in your social media strategy in the future?"
46. 開発開始!
> rails new twit -T
create
create README.rdoc
...
run bundle install
...
Your bundle is complete! Use `bundle
show [gemname]` to see where a
bundled gem is installed.
94. scaffold
db/migrate/
20120320181856_create_users.rb
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.timestamps
end
end
end
95. scaffold
db/migrate/
20120320181856_create_users.rb
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.timestamps DBの「手順書」
end
end
end
107. model generator
db/migrate/
20120320213424_create_tweets.rb
108. model generator
db/migrate/
20120320213424_create_tweets.rb
class CreateTweets < ActiveRecord::Migration
def change
create_table :tweets do |t|
t.string :body
t.integer :user_id
t.timestamps
end
end
end
109. model generator
db/migrate/
20120320213424_create_tweets.rb
class CreateTweets < ActiveRecord::Migration
def change
create_table :tweets do |t|
t.string :body
t.integer :user_id
t.timestamps DBの「手順書」
end
end
end
150. つぶやきを表示
app/controllers/users_controller.rb
# GET /users/1
# GET /users/1.json
def show
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
151. つぶやきを表示
app/controllers/users_controller.rb
# GET /users/1
# GET /users/1.json
def show
@user = User.find(params[:id])
showアクション=users/1
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
152. つぶやきを表示
app/controllers/users_controller.rb
# GET /users/1
# GET /users/1.json
def show
@user = User.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @user }
end
end
172. つぶやく
app/controllers/users_controller.rb
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
end
173. つぶやく
app/controllers/users_controller.rb
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
end 末尾のendの前に新しいメソッドを追加
174. つぶやく
app/controllers/users_controller.rb
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
end
176. つぶやく
app/controllers/users_controller.rb
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
# POST /users/1/tweet
def tweet
@user = User.find(params[:id])
@tweet = @user.tweets.create(:body => params[:body])
redirect_to @user, notice: 'Tweet was successfully updated.'
end
end
177. つぶやく
app/controllers/users_controller.rb
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
# POST /users/1/tweet
def tweet
@user = User.find(params[:id])
@tweet = @user.tweets.create(:body => params[:body])
redirect_to @user, notice: 'Tweet was successfully updated.'
end
end
追加
178. つぶやく
app/controllers/users_controller.rb
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end
# POST /users/1/tweet @user.tweets.createでtweetを追加
def tweet
@user = User.find(params[:id])
@tweet = @user.tweets.create(:body => params[:body])
redirect_to @user, notice: 'Tweet was successfully updated.'
end
end
追加