TimeTicket, SPIKE 比較

IB・留学・帰国子女枠受験で差をつける!Skypeセッションspike.cc Pay Now

heroku ステージング環境づくり/ Permission Denied, error 503

エラー内容: [Terminal] git push heroku bugfix:master ! Heroku has temporarily disabled this feature, please try again shortly. ! See http://status.heroku.com for current Heroku platform status. fatal: Could not read from remote repository…

heroku domainをほかのherokudomainに変える方法

はじめ: ➜ ibhiroba1 git:(bugfix) git remote -vheroku git@heroku.com:ibhiroba1-0403.git (fetch)heroku git@heroku.com:ibhiroba1-0403.git (push)origin git@github.com:HOkn/ibhiroba1.git (fetch)origin git@github.com:HOkn/ibhiroba1.git (push) …

Rails Appをherokuにデプロイする

RailsアプリをHerokuにデプロイするcyllabus.jp bundle install heroku run rake db:migrateを忘れないこと! How to change git url for app on Herokustackoverflow.com

Rails sorcery 新規登録ができない

解決:view file form_for を<table> タグ内部でなく 外部にして、tableタグを囲む。 コントローラー: class RegistrationsController < ApplicationController def new @user = User.new end def create @user = User.new(params_user) if @user.save raise login</table>…

Railsログアウトできない sorcery

terminal でのログ: Started DELETE "/sessions" for ::1 at 2015-04-08 23:57:38 +0900Processing by SessionsController#destroy as HTMLCan't verify CSRF token authenticityRedirected to http://localhost:3000/questionsCompleted 302 Found in 5ms …

routes.rb でエラー /1 ではなく.1となってしまう

問題: users#show にいきたいのだがhttp://localhost:3000/users/1 とはならず http://localhost:3000/users.1 となってしまった。 エラー: ActiveRecord::RecordNotFound at /users.1 Couldn't find User with 'id'= 他のページでのエラー: NoMethodErro…

routingエラー

users_path GET /users(.:format) users#show GET /users/:id(.:format) users#show

Rails HAMLでもGoogle Analyticsを使える!gem google-analytics-rails

https://github.com/bgarret/google-analytics-rails

Rails radio button エラー解決した例

ラジオボタン(radio button)でのエラー なぜかvalueを選ぶとエラーメッセージが出ずに、コントローラーを呼べない。 解決: value = "ibparent" ではなく、 :value => "parent"などとすること! ただしいコード: %tr %td.alignright 立場*: %td.radio =f…

Rails trタグの大きさを変える方法

table, tbody, td, tr, の大きさを変える方法 padding-bottom: 20px など やっても意味ない: marginの定義 How do I increase the width of a column in an HTML table?stackoverflow.com

table テーブルのデータのidだけ取る

@categoriesid = Category.select(:id)

Rails projectを作るときの順番 メモ

1projectをつくる 2modelをつくる 3model files (---.rb)を書く 4rails console コンソールでデータを入力して、controllerに書く処理を確認 5view file ビューを書く 6(gem 'better errors'やinspectメソッドを使って)ビューからコントローラーに渡…

Rails nested_attributes Could not find the association :question_category in model Question

間違えたコード: / <% @categories.each do |c| %> / <%= check_box :category, :id, {}, c.id %> / <%= c.name %> / <% end %> / - @categoriesid.each do |id| / = check_box :id, id / category, nil / = category.name / - @categories.each do |catego…

Rails 複数選択check_box_tag 例

"undefined method 'merge'などのエラーについて 解決例: = f.check_box(:kindergarten, {}, true, false)注意! = f.check_box ( :high, { :multiple => true }, true, false)のようにboxのあとスペースを入れるとエラー! syntax error, unexpected ',', …

Rails each_with_index tag 使い方

例: View file: - @categories.each_with_index do |category,i| = check_box_tag "category#{i+1}", category.id = category.name 注意:このとき|i, category|とするとエラー。| ビュー: カテゴリーidを入れるパラメーターの名前を category1 category2 …

Rails 使い分け find_by! where

お気に入り機能 お気に入りに入っているかどうかを見極める関数 questionをお気に入りに追加する場合、model/question.rb に関数を書く。 エラーしたコード; def favorited_by?(user, question) Favorite.where(user_id: user.id).find_by!(question_id: qu…

Rails カテゴリ分け through

Question, Category, Question_Category という3つのモデルを作ると、 Question生成のときにその数だけcategoryを生成しなくてすむ。 すると、カテゴリ数は一定で決められるので、 カテゴリーごとのQuestionをリストアップできるようになる。 参考リンク: …

Rails 変数をcontrollerで入力するとき paramsがセーブできないときのエラー

変数をcontrollerで入力するときparamsがセーブできないときのエラー create(saveというメソッドも同時にしてしまうメソッド)ではなく、そこでbuildを使ってからsaveさせる。 元のコード: def create @user = current_user @question = Question.find(param…

Rails undefined method `where' for nil:NilClass

undefined method `where' for nil:NilClass コード: - @questions.where(user_id: current_user.id).where(id: id).each do |question|

Rails Facebookシェアできるようにするリンク

もくじ 1:シェアできるようにするリンクの貼り方 2:シェアされるときの画像指定の方法 ー1: <%= link_to image_tag('/images/FaceBookIcon.png'), 'http://www.facebook.com/sharer.php?u='+request.fullpath, :target => :blank %> up vote5down vote…

Haml ページ内リンクのつけ方

HTMLからの自動変換: ビューファイル(リンク元): %a{:href => "file:///Users/HOkaniwa/Desktop/IBplat%202/Questions%23index_category.html#category1", :title => "", :target => "blank"} ・家庭学習 機能するHaml: =link_to "回答する", :action => …

if user logged_in? チュートリアル

Chapter 8: Log in, log out | Ruby on Rails Tutorial (3rd Ed.) | Softcover.io Listing 8.15: The logged_in? helper method.app/helpers/sessions_helper.rb module SessionsHelper # Logs in the given user. def log_in(user) session[:user_id] = use…

Rails投稿者のidを投稿に登録する方法

投稿者のidを投稿に登録する方法 エラーメッセージ:NoMethodError at /users/4/questions/17undefined method `user_id' for #

投稿者しか見れないボタンをつくる

- if current_user.id == @question.user_id = link_to "編集", edit_user_question_path(current_user, @question), :class => "a edit btn btn-primary float_right"

favoritesお気に入り機能 メモ

引数と式を.rb fileで定義 HAMLで代入する値を入れて、式を使う。 このときquestionと連携させたかったので、その引数も"user"のほかにつける必要があった。 HAML; -if @question.favorited_by?(current_user, @question) = link_to "お気に入りを解除", que…

Rails Checkboxの使い方 サイトまとめ3つ

Using checkboxes in railsstackoverflow.com プログラマの覚書: Rails チェックボックスの配列化(修正) 【Rails3.1】複数のチェックボックスの処理 : ノンプログラマーブログ

rails consoleの[END]から抜け出す方法

q とタイプ。

ページ内リンク link_to にクラスをつけたいけれどできない

クラスをつけない場合: =link_to "回答する", :action => 'show', :anchor => 'answer' 参考: link_toでアンカーリンク(ページ内リンク)へ飛ばす方法 - マオの徒然日記gutch.hatenablog.com クラスをつける場合: ????? 失敗したコード: =button_t…

notice、alert 表示

noticeの表示 Settings#editのnotice app/controllers/settings_controller.rb 6 6 def update 7 7 @user = current_user 8 8 if @user.update_attributes(params_user) 9 redirect_to user_url(@user) 9 redirect_to user_url(@user), notice: "プロフィー…