$ rails g model User
belongs_to
has_one
| #Session controller provides a token | |
| #/controllers/api/sessions_controller.rb | |
| class Api::SessionsController < Devise::SessionsController | |
| before_filter :authenticate_user!, :except => [:create] | |
| before_filter :ensure_params_exist, :except => [:destroy] | |
| respond_to :json | |
| def create | |
| resource = User.find_for_database_authentication(:email => params[:user_login][:email]) | |
| return invalid_login_attempt unless resource |
| haiku = -> | |
| adjs = [ | |
| "autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark", | |
| "summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter", | |
| "patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue", | |
| "billowing", "broken", "cold", "damp", "falling", "frosty", "green", | |
| "long", "late", "lingering", "bold", "little", "morning", "muddy", "old", | |
| "red", "rough", "still", "small", "sparkling", "throbbing", "shy", | |
| "wandering", "withered", "wild", "black", "young", "holy", "solitary", | |
| "fragrant", "aged", "snowy", "proud", "floral", "restless", "divine", |
| require 'active_model' | |
| # Most of this is the basic boilerplate described in the docs for active_model/errors; ie, the bare minimum | |
| # a class must have to use AM::Errors | |
| class Post | |
| extend ActiveModel::Naming | |
| attr_reader :errors | |
| attr_accessor :title, :author, :publication_date |
error Can't install RMagick 0.0.0. Can't find MagickWand.h.
this helped me - http://stackoverflow.com/a/15745852
Problems
Library not loaded: @@HOMEBREW_CELLAR@@/openssl/1.0.1l/lib/libcrypto.1.0.0.dylib
Referenced from: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Reason: image not found - ~/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/x86_64-darwin14.0.0/openssl.bundle (LoadError)
~/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(~/.rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/x86_64-darwin14.0.0/digest/sha1.bundle, 9): Library not loaded: @@HOMEBREW_CELLAR@@/openssl/1.0.1l/lib/libcrypto.1.0.0.dylib (LoadError)
Referenced from: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Reason: image not found - .rvm/rubies/ruby-1.9.3-p547/lib/ruby/1.9.1/x86_64-darwin14.0.0/digest/sha1.bundle| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| config.filter_parameters += [:password, :password_confirmation, :auth_token] |
| # spec/spec_helper.rb | |
| config.after(:all, db: true) do | |
| puts | |
| puts | |
| FactoryPolice.report | |
| end | |
| # spec/support/factory_police.rb |
| ActiveRecord::Base.connection.tables.each do |table| | |
| next if table.match(/\Aschema_migrations\Z/) | |
| klass = table.singularize.camelize.constantize rescue nil | |
| if klass && klass.count > 0 | |
| throw "#{klass.name} has #{klass.count} records" | |
| end | |
| end |