This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/model/user.rb | |
attr_accessible :name, :first_name, :last_name, :email, :password, :password_confirmation, :remember_me, | |
:provider, :uid, :photos_attributes | |
has_many :photos | |
accepts_nested_attributes_for :photos | |
#/model/photo.rb | |
class Photo < ActiveRecord::Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
event=button.fnf1 FNF1 | |
action=/etc/acpi/actions/toggle-touchpad.sh "%e" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="#" data-dropdown="drop" class="button dropdown">Dropdown Button</a><br> | |
<ul id="drop" data-dropdown-content class="f-dropdown"> | |
<li><a href="#">This is a link</a></li> | |
<li><a href="#">This is another</a></li> | |
<li><a href="#">Yet another</a></li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! 5 | |
%html{:lang => "en"} | |
%head | |
%meta{:charset => "utf-8"} | |
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"} | |
%title | |
=content_for?(:title) ? yield(:title) : "Analuk" | |
= stylesheet_link_tag "application" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<meta charset='utf-8'> | |
<meta content='width=device-width, initial-scale=1.0' name='viewport'> | |
<title> | |
Analuk | |
</title> | |
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PostsController < ApplicationController | |
before_filter :authenticate_user! | |
def new | |
@post = Post.new | |
end | |
def create | |
@user = User.find(params[:user_id]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if current_user == @user %> | |
<h2>Tilføj et indlæg:</h2> | |
<%= simple_form_for([@user, @user.posts.build], :html => { :class => 'form-horizontal'}) do |f| %> | |
<%= f.error_notification %> | |
<div class="form-inputs"> | |
<%= f.input :title, :required => true, :autofocus => true %> | |
<%= f.input :description, :required => true %> | |
<%= f.input :location, :required => true %> | |
<%= f.input :photo %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# views/posts/_post.html.erb | |
<% @posts.sort_by(&:created_at).reverse.each do |p| %> | |
<div class="panel panel-default"> | |
...... | |
</div> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want to sort the data by uid(this set only has one uid), and then be able to choose only to get answers or questions grouped by uid. | |
[#<Response id: 37, question: "Region", answer: "Other Asian country", date: "2015-02-04", count: nil, created_at: "2015-02-04 12:39:34", updated_at: "2015-02-04 12:39:34", uid: "1423053574502", quiz_id: 1>, #<Response id: 38, question: "Profession", answer: "Neurologist", date: "2015-02-04", count: nil, created_at: "2015-02-04 12:39:34", updated_at: "2015-02-04 12:39:34", uid: "1423053574502", quiz_id: 1>, #<Response id: 39, question: "Experience with increased L-dopa dose/frequency cau...", answer: "Yes", date: "2015-02-04", count: nil, created_at: "2015-02-04 12:39:34", updated_at: "2015-02-04 12:39:34", uid: "1423053574502", quiz_id: 1>, #<Response id: 40, question: "Azilect's perceived efficacy compared to entacapone...", answer: "Less efficacious", date: "2015-02-04", count: nil, created_at: "2015-02-04 12:39:34", updated_at: "2015-02-04 12:39:34", uid: "1423053574502" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@quiz.responses.group(:uid).all.each {|uid, responses| puts "hello i'm #{uid} and my first response was: "} | |
=> [#<Response id: 46, question: "Region", answer: "South Korea", date: "2015-02-04", count: nil, created_at: "2015-02-04 12:42:03", updated_at: "2015-02-04 12:42:03", uid: "1423053723649", quiz_id: 3>, #<Response id: 55, question: "Region", answer: "Other Asian country", date: "2015-02-04", count: nil, created_at: "2015-02-04 12:43:40", updated_at: "2015-02-04 12:43:40", uid: "1423053820457", quiz_id: 3>, #<Response id: 73, question: "Region", answer: "Hong Kong", date: "2015-02-16", count: nil, created_at: "2015-02-16 13:31:47", updated_at: "2015-02-16 13:31:47", uid: "1424093507276", quiz_id: 3>] |
OlderNewer