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
namespace :forum do | |
resources :forums do | |
collection do | |
get 'sort' | |
post 'update_sort' | |
end | |
end | |
resources :topics do | |
member do | |
get 'lock' |
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
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
# Be sure to have rails and thin installed. | |
require "rubygems" | |
# We are not loading Active Record, nor the Assets Pipeline, etc. | |
# This could also be in your Gemfile. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
# The following lines should come as no surprise. Except by |
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
def show | |
if params["product_search"].present? | |
@product = Product.find_by_name(params["product_search"][:name]) | |
if @product.blank? | |
redirect_to(products_path, :notice => "Not Found") | |
return | |
end | |
else | |
@product = Product.find(params[:id]) | |
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
require 'date' | |
require 'bigdecimal/newton' | |
require 'bigdecimal/math' | |
include Newton | |
class XIRR | |
def initialize(datevalues) | |
@datevalues = datevalues | |
@zero = BigDecimal::new("0.0") |
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
def index | |
if Rails.env == "development" | |
longitude = "-95.2752" | |
latitude = "29.9459" | |
else | |
longitude = request.location.longitude | |
latitude = request.location.latitude | |
end | |
@venues = Venue.near([latitude, longitude].join(", "), 60) |
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
<%= form_for(@post) do |f| %> | |
<% if @post.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2> | |
<ul> | |
<% @post.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</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
Parameters: {"commit"=>"Create Post", "post"=>{"category"=>"asd", "title"=>"asd", "content"=>"asd", | |
"attachments_attributes"=>{"0"=>{"photo"=>#<ActionDispatch::Http::UploadedFile:0x1286485d8 @content_ | |
type="image/jpeg", @headers="Content-Disposition: form-data; name=\"post[attachments_attributes][0][p | |
hoto]\"; filename=\"DL_fb_WhereToBuy04.jpeg\"\r\nContent-Type: image/jpeg\r\n", @original_filename="D | |
L_fb_WhereToBuy04.jpeg", @tempfile=#<File:/var/folders/Kf/Kfc30tagH0mUfSKvAItau++++TM/-Tmp-/RackMulti | |
part20111104-18330-1dwd89-0>>}}}, "authenticity_token"=>"x24T9Td1tuZ78pYTcytwwX84+gcPVIrMhVmEp/BYGJ0= | |
", "utf8"=>"✓", "attachment_category"=>{"id"=>"2"}} |
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
#Inside Photo model | |
has_attached_file :file, | |
:processors => [ :blurplates, :thumbnail ], | |
:styles => { :frontpage => "460x100000", :view => "740x100000", :medium => '300x300', :thumb => "100x100>" } | |
#blurplates.rb | |
# Load libs | |
require 'camellia' |
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 Application < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :job | |
# This model can also have validations to ensure applications are valid, whatever you want. | |
# Extra fields can also be added to this file, so it might get another field :rejected for example. | |
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
ree-1.8.7-2011.03 :001 > GolfBall.without_dimples | |
NameError: undefined local variable or method `dimples' for #<Class:0xc0c0290> |
NewerOlder