Skip to content

Instantly share code, notes, and snippets.

View universal's full-sized avatar

Johannes / universa1 universal

View GitHub Profile
irb(main):001:0> User.create(name: "dudu", email: "[email protected]", password: "1234", password_confirmation: "1234")
(1.0ms) begin transaction
User Exists (0.0ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('[email protected]') LIMIT 1
Binary data inserted for `string` type on column `password_digest`
SQL (4.0ms) INSERT INTO "users" ("created_at", "email", "name", "password_digest", "updated_at") VALUES (?, ?, ?, ?
[["created_at", Mon, 18 Nov 2013 20:50:04 UTC +00:00], ["email", "[email protected]"], ["name", "dudu"], ["password_digest
2a$10$ENowSeWI6nGZbVIHVUBfuuwKEWeZ9I81Ci/Nru2Q6Q0.paUi7kFXu"], ["updated_at", Mon, 18 Nov 2013 20:50:04 UTC +00:00]]
(74.1ms) commit transaction
=> #<User id: 5, name: "dudu", email: "[email protected]", created_at: "2013-11-18 20:50:04", updated_at: "2013-11-18 20:50
password_digest: "$2a$10$ENowSeWI6nGZbVIHVUBfuuwKEWeZ9I81Ci/Nru2Q6Q0....">
class Feature < ActiveRecord::Base
has_one :project_item, as: :item, class_name: "ProjectItem"
end
class Milestone < ActiveRecord::Base
has_one :project_item, as: :item, class_name: "ProjectItem"
end
@universal
universal / paul.c
Created December 10, 2013 21:21 — forked from anonymous/paul.c
pow(pow(x, n / 2), 2)
pow(x, n / 2) * pow(x, n / 2)
class Admin < User
has_one :user, :as => :userable
attr_accessible :user
end
class UserPasswordResetsController < ApplicationController
#personal preferences here
def update
user = User.find_by(password_reset_token: params[:id])
if !user.present?
head :not_found
elsif !(user.is_activated && user.is_active)
head :unprocessable_entity
elsif user.update_password params[:password], params[:password_confirmation]
head :ok
def show
@video = Video.find(params[:id])
@related = @video.find_related_tags.limit(4)
end
=====
<h4>Similar videos:</h4>
<ul class="large-block-grid-4 small-block-grid-2 medium-block-grid-3">
<%= @related.size %>
<ul>
<% @users.each do |user| %>
<li>
<%= link_to("1. Letter of Representation", letter_of_user_path(user) %>
</li>
<% end %>
</ul>
--- !ruby/hash:ActionController::Parameters
id: e6249bf8-562a-48ed-8a0e-0b5c89a96409
mini_story_attributes: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
id: a43fa828-345a-43c1-9d54-86ea5e8e8212
name: Empty MS
generic_function_views_attributes:
sequential_execution_views_attributes:
delayed_selection_views_attributes:
simple_merge_views_attributes:
exclusive_selection_views_attributes:
<strong>Name:</strong>
<%= activity.name %><br/>
<br/>
<%= image_tag(activity.image_url, :size => '250x250') %>
<br/>
<strong>Location</strong>
<%= activity.location %><br/>
<strong>Duration:</strong><br/>
<%= activity.start_date %><br/>
<%= activity.end_date %><br/>
class GroupsTrainer < ActiveRecord::Base
attr_accessible :area, :name, :trainer_id
belongs_to :trainer
has_many :home_gardeners
end