Skip to content

Instantly share code, notes, and snippets.

View universal's full-sized avatar

Johannes / universa1 universal

View GitHub Profile
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
class Row
attr_accessor :supervisor_name, :name, :emp_pending, :sup_pending, :approved
def to_s
"Test #{@supervisor_name}, #{@name}, #{@emp_pending}, #{@sup_pending}, #{@approved}, #{total}, #{status}"
end
def total
@emp_pending + @sup_pending + @approved
end
<%= form_for Group.new do |f| %>
<table summary = "groups from trainer">
<tr>
<th><%= f.label(:name) %></th>
<td><%= f.text_field(:name) %></td>
</tr>
<tr>
<th><%= f.label(:area) %></th>
<td><%= f.text_field(:area) %></td>
</tr>
@universal
universal / find.rb
Last active August 29, 2015 14:02 — forked from adammcarth/find.rb
class JTask
# JTask.find()
# Retrieves records from the database file.
# --------------------------------------------------------------------------------
# Eg: JTask.find("test.json", 1) || JTask.find("test.json", first: 10)
# #=> <JTask id=x, ...>
# --------------------------------------------------------------------------------
# See wiki guide for more usage examples...
# https://github.com/adammcarthur/jtask/wiki/find