Skip to content

Instantly share code, notes, and snippets.

View acidtib's full-sized avatar

Dainel Vera acidtib

View GitHub Profile
/Users/dainelvera/Code/Rails/thecollegetourist/app/controllers/explore_controller.rb:36: syntax error, unexpected '|', expecting '}'
@towns.each do { |t| if t.postcards.empty? @tow...
^
/Users/dainelvera/Code/Rails/thecollegetourist/app/controllers/explore_controller.rb:36: syntax error, unexpected keyword_end, expecting keyword_then or ';' or '\n'
...rds.empty? @towns.delete(t) end }
... ^
@acidtib
acidtib / view
Created August 27, 2012 17:58
controller
def explore
@states = State.find(params[:id])
@towns = @states.towns.paginate(:page => params[:page], :per_page => 9)
#@towns.each do |t|
@towns.each {|t| if t.postcards.empty? @towns.delete(t) end }
t.postcards.last
end
end
@acidtib
acidtib / Does not work
Created September 28, 2012 18:35
CarrierWave with Device
class Admin < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
def self.from_omniauth(auth,admins)
where(auth.slice(:provider, :uid)).first_or_initialize.tap do |authentication|
authentication.admin_id = admins.id
authentication.provider = auth.provider
authentication.uid = auth.uid
authentication.oauth_token = auth.credentials.token
authentication.oauth_expires_at = Time.at(auth.credentials.expires_at)
authentication.save!
end
end
config.assets.precompile += %w( frontend.css frontendlogin.css backend.css backendlogin.css frontend.js frontendlogin.js backend.js backendlogin.js )
require "bundler/capistrano"
server "198.61.216.231", :web, :app, :db, primary: true
set :application, "samurai"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
@states.each{|t| if t.postcards.empty? t.postcards.delete(t) }
t.postcards.last
t.postcards.count
t.towns.last
end
@states = State.find(params[:id])
@towns = @states.towns.paginate(:page => params[:page], :per_page => 9).order("town")
@towns.each do |t|
t.postcards.last
t.postcards.count
end
end
/Users/dainelvera/Code/Rails/thecollegetourist/app/controllers/explore_controller.rb:60: syntax error, unexpected '}', expecting keyword_then or ';' or '\n'
/Users/dainelvera/Code/Rails/thecollegetourist/app/controllers/explore_controller.rb:63: syntax error, unexpected keyword_end, expecting '}'
/Users/dainelvera/Code/Rails/thecollegetourist/app/controllers/explore_controller.rb:81: syntax error, unexpected keyword_end, expecting '}'
/Users/dainelvera/Code/Rails/thecollegetourist/app/controllers/explore_controller.rb:171: syntax error, unexpected keyword_end, expecting '}'
$(document).ready( function() {
//If state and city match then provide id
$('#postcard_state'),
$('#postcard_city')
.bind('change', function (e) {
if( $('#postcard_state').val() == "Alabama" && $('#postcard_city').val() == "Abbeville city") {
$("#hidden_town_id").html("<input id='postcard_town_id' name='postcard[town_id]' type='hidden' value='1'>");
}
else if( $('#postcard_state').val() == "Alabama" && $('#postcard_city').val() == "Adamsville city") {
$("#hidden_town_id").html("<input id='postcard_town_id' name='postcard[town_id]' type='hidden' value='2'>");