This file contains hidden or 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
<form action="<%= posts_url %>" method="post"> | |
<label for="title">Title</label> | |
<input type="text" name="post[title]" value="<%= @post.title %>"> | |
<br /> | |
<label for="link_1">Link 1</label> | |
<input type="text" name="post[links_attributes][0][url]">> | |
<br /> | |
<label for="link_2">Link 2</label> | |
<input type="text" name="post[links_attributes][1][url]"> | |
<br /> |
This file contains hidden or 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
def self.comments_by_parent(link) | |
comments = link.comments | |
result = Hash.new { |hash, key| hash[key] = []} | |
comments.each do |comment| | |
result[comment.parent_comment_id] << comment | |
end | |
result | |
end |
This file contains hidden or 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
<ul> | |
<% @comments_by_parent[nil].each do |comment| %> | |
<%= render "comment", :comment => comment, :comments_by_parent => @comments_by_parent %> | |
</ul> | |
<% end %> |
This file contains hidden or 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
<li><p><%= comment.body %> | |
</p> | |
</li> | |
<h4>Comment ON A COMMENT</h4> | |
<p class="teeny">so meta</p> | |
<%= render "new_comment", :link => comment.link, :parent_comment_id => comment.id %> | |
<% if comments_by_parent[comment.id] != [] %> | |
<ul> | |
<% comments_by_parent[comment.id].each do |subcomment| %> | |
<%= render "comment", :comment => subcomment, :comments_by_parent => comments_by_parent %> |
This file contains hidden or 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
##Check uniqueness of email----------------------------------------------- | |
#in migration | |
add_index :users, :email, :unique => true | |
#but that doesn't cover case insensitive | |
#in the model take email to lowercase before save | |
class User.. | |
attr_accessible :email | |
#this gives you custom message for the error |
This file contains hidden or 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
Function.prototype.inherits = function(parent){ | |
function Surrogate(){}; | |
Surrogate.prototype = parent.prototype; | |
this.prototype = new Surrogate(); | |
} |
This file contains hidden or 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
gem_group :development, :test do | |
gem 'rspec-rails' | |
gem 'factory_girl_rails' | |
end | |
gem_group :test do | |
gem 'faker' | |
gem 'capybara' | |
gem 'guard-rspec' | |
gem 'launchy' |
This file contains hidden or 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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="media_qs.css" > | |
</head> | |
<body> | |
<b>HELLO WORLD.</b> | |
</body> | |
</html> |
This file contains hidden or 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
require 'spec_helper' | |
describe "ToDoMVC:Backbone.js" do | |
# the following is a demo spec for demonstration purposes | |
# it is meant to run on the ToDoMVC:Backbone.js Demo app: | |
# http://todomvc.com/architecture-examples/backbone/ | |
it "allows creation of a todo-list item", :js => true do | |
visit "http://todomvc.com/architecture-examples/backbone/" | |
fill_in "new-todo", with: "TODOITEM Hello World\n" |
This file contains hidden or 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
/** | |
* @see http://webpack.github.io/docs/configuration.html | |
* for webpack configuration options | |
*/ | |
module.exports = { | |
// 'context' sets the directory where webpack looks for module files you list in | |
// your 'require' statements | |
context: __dirname + '/app/assets/javascripts', | |
// 'entry' specifies the entry point, where webpack starts reading all |