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
private | |
# Use callbacks to share common setup or constraints between actions. | |
def set_statement | |
@statement = Statement.find(params[:id]) | |
end | |
def set_article | |
@article = Article.find(params[:article_id]) | |
end | |
# Never trust parameters from the scary internet, only allow the white list through. | |
def statement_params |
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
class Comment | |
include Neo4j::ActiveNode | |
property :name, type: String | |
property :content, type: String | |
has_one :out, :post, type: :post | |
has_one :in, :post, rel_class: :AgreeComment | |
has_one :in, :post, rel_class: :DisagreeComment | |
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
<%= form_for([@post, @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 |message| %> | |
<li><%= message %></li> | |
<% end %> | |
</ul> |
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
class BillsController < ApplicationController | |
LEGISCAN_URL = 'https://api.legiscan.com/?key=' | |
LEGISCAN_STATE_SEARCH = 'op=getMasterList&state=' | |
LEGISCAN_STATE_API_CALL = LEGISCAN_URL + LEGISCAN_API_KEY + LEGISCAN_STATE_SEARCH | |
def show | |
//ERROR RETUNS NIL ON IMPLICIT STRING CONVERSION FOR API KEY ABOVE | |
@bill_api = JSON.parse(HTTParty.get('https://api.legiscan.com/?key=77f939393jfjfdcb&op=getBill&id=' + params[:id]).body) | |
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
// Create a function that holds another function which will "create" a name | |
function init(){ | |
// Global variable inside the function to be used after initialization | |
firstName = "FIRST NAME" | |
// Second function is what returns the global variable | |
function createName(n){ | |
return n | |
} | |
return createName(firstName); | |
} |
NewerOlder