Skip to content

Instantly share code, notes, and snippets.

<%= form_for(@comment) do |f| %>
<% if @comment.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
<ul>
<% @comment.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
class CommentsController < ApplicationController
before_action :set_comment, only: [:show, :edit, :update, :destroy]
# GET /comments
# GET /comments.json
def index
@comments = Comment.all
end
# GET /comments/1
class Comment < ActiveRecord::Base
belongs_to:user
end
Started POST "/comments" for 127.0.0.1 at 2014-02-20 15:17:29 +0800
Processing by CommentsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"e5H/BFDMZgm95XBV+vViasyFIQdSZ7qKflZqEEHN8kY=", "comment"=>{"user_id"=>"1", "comments_text"=>"test"}, "commit"=>"Create Comment"}
Unpermitted parameters: user_id
(0.2ms) BEGIN
SQL (0.6ms) INSERT INTO "comments" ("comments_text", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["comments_text", "test"], ["created_at", Thu, 20 Feb 2014 07:17:29 UTC +00:00], ["updated_at", Thu, 20 Feb 2014 07:17:29 UTC +00:00]]
(0.6ms) COMMIT
Redirected to http://localhost:3000/comments/6
Completed 302 Found in 6ms (ActiveRecord: 1.4ms)
Kevins-MacBook-Pro:bin megasap$ ./tesseract.rb
/Users/megasap/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- tesseract (LoadError)
from /Users/megasap/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./tesseract.rb:3:in `<main>'
$ tesseract.rb
/Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/compilers/gcc.rb:35:in `compile': compile error: see logs at /var/folders/kn/3yv3c00x0ms740g_8p4xpypm0000gn/T/.ffi-inline-501/b1d9f0795e587aad2ea988a39c4c9f6bf2b07cc3.log (CompilationError)
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders/c.rb:114:in `shared_object'
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:90:in `block in build'
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in `instance_eval'
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/builders.rb:87:in `build'
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:54:in `singleton_inline'
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/ffi-inline-0.0.4.3/lib/ffi/inline/inline.rb:39:in `inline'
from /Users/megasap/.rvm/gems/ruby-2.1.0/gems/tesseract-ocr-0.1.
<h1>Listing payment_accounts</h1>
<table>
<thead>
<tr>
<%= @x %>
<th>Name</th>
<th>Company</th>
<th>Data</th>
<th></th>
<h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
<%= devise_error_messages! %>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
belongs_to :country
has_many :companies, :through => :company_user_assoc
class CreateCountries < ActiveRecord::Migration
def change
create_table :countries do |t|
t.string :name
t.string :country_code
t.string :currency_name
t.string :currency_code
t.decimal :rate
t.timestamps