2015-01-01から1年間の記事一覧

bootstrap install

BUNDLER First, make sure you use bundler >= 1.8.4 Add https://rails-assets.org as a new gem source, then reference any Bower components that you need as gems in the following convention: source 'https://rails-assets.org' do gem 'rails-asse…

Github 共同開発ブランチなど

GitHub - 開発フロー研修 @ Wantedly - Qiitaqiita.com <ブランチ> つくる 名前: アカウント名/作業名 コメントをもらう まーじ けす git branch -d (ここに名前かく--- ーーーーーーーーーーーーメモーーーーーーーーー ikefure git:(HOkn/admin-form) g…

mysql はじめてのインストールから

まとめ インストールからデータベース利用の解説・問題まで 1)ORACLEアカウント作成、mysqlページでログイン MySQL :: MySQL Downloadsへ行く。 2)インストール(Macの場合Macを選択) 参考: MySQL 5.6.11 ダウンロード - MySQLインストールwww.dbonline.…

Rails undefined method `delete'

'delete'と書いていないのにエラー: undefined method `delete' for true:TrueClass もとのコード: =form_for :school, url: schools_path do |f| =check_box :kindergarten, { :multiple => true }, true, false 直したコード: =form_for :school, url: …

Pusher を使ってRailsチャットを実装するためのリンク集

・Add Realtime chat widget to any web page | Pusher ・RailsとHerokuでノーティフィケーションをプッシュする / PusherとTurbolinksの兼ね合い www.workabroad.jp ・Documentation | Pusher ・ Ruby - Rails3.2.8 + Pusher - Qiitaqiita.com ・PusherとRu…

Rails4で多対多のリレーションをモデルに実装する - Rails Webookruby-rails.hatenadiary.com

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 #