Skip to content

Instantly share code, notes, and snippets.

View px-amaac's full-sized avatar

Aaron McIntyre px-amaac

View GitHub Profile
@px-amaac
px-amaac / gist:5329319
Last active December 15, 2015 21:59
Bootstrap stuff from appscomposer--its crap see my replacement code.
<%-# from users/indes.html.erb -%>
<a data-toggle="modal" href="#role-options-<%= user.id %>" class="btn btn-mini" type="button">Change role</a>
<%-# from users/_user.html.erb -%>
<div id="role-options-<%= user.id %>" class="modal" style="display: none;">
<%= simple_form_for user, :url => user_path(user), :html => {:method => :put, :class => 'form-horizontal' } do |f| %>
<div class="modal-header">
<a class="close" data-dismiss="modal">&#215;</a>
<h3>Change Role</h3>
@px-amaac
px-amaac / gist:5329331
Created April 7, 2013 06:43
This is the code that i replaced the bootstrap stuff with. It is missing something.
<%-# from users/index.html.erb -%>
<a href="roles#<%= user.id %>" data-reveal-id="roleModal" class="button" type="button">Change role</a>
<%= render user %>
<%-# from users/_roles.html.erb-%>
<div id="roleModal" class="reveal-modal">
<%= semantic_form_for user, :url => user_path(user), :html => {:method => :put } do |f| %>
<h3>Change Role</h3>
<div class="reveal-modal-body">
@px-amaac
px-amaac / new.html.erb
Last active December 16, 2015 01:09
The Code for my multiple picture uploads and the logs from the rails server
Started POST "/posts" for 127.0.0.1 at 2013-04-10 00:38:13 -0700
Processing by PostsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"CJfQnNIl/e0UEwguNAjZ5bEP3snoO0CxXDjQOB3srQk=", "post"=>{"name"=>"New post", "description"=>"Not Working", "icon"=>#<ActionDispatch::Http::UploadedFile:0x0000000513c158 @original_filename="apple-logo.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"post[icon]\"; filename=\"apple-logo.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<Tempfile:/tmp/RackMultipart20130410-7778-1llvrgq>>, "post_pics_attributes"=>{"0"=>{"image"=>#<ActionDispatch::Http::UploadedFile:0x000000051438e0 @original_filename="officialLogo200.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"post[post_pics_attributes][0][image]\"; filename=\"officialLogo200.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<Tempfile:/tmp/RackMultipart20130410-7778-1jymz7d>>}, "1"=>{"image"=>#<ActionDispatch::Http::UploadedFile:0x00
@px-amaac
px-amaac / app.rb
Created April 10, 2013 08:26
Appdomumsite Having trouble with image uploads. The icon shows up but the multiple nested files are not showing up.
class App < ActiveRecord::Base
attr_accessible :description, :name, :icon, :app_screenshots_attributes
has_many :app_screenshots, :dependent => :destroy
belongs_to :user
accepts_nested_attributes_for :app_screenshots, :reject_if => lambda{ |t| t['app_screenshot'].nil? }, :allow_destroy => true
validates :name, presence: true
validates :description, presence: true
has_attached_file :icon, :styles =>{ :medium => "300x300>", :thumb => "150x150>" }, :default_url => "/images/:style/missing.png"
@px-amaac
px-amaac / app_screenshot.rb
Created April 10, 2013 18:24
I am not understanding the :url and :path. Where is the root of these paths. ? Clearly for path it is rails root. What do both of these do?? is the url just what is displayed and the path is where they are actually stored?
has_attached_file :image, :styles => { :small => "480x320>", :large => "920x640>"},
:url => '/assets/images/:class/:id/:style.:extension',
:path => '/:rails_root/assets/images/:class/:id/:style.:extension'
@px-amaac
px-amaac / from_foundation_docs.html
Last active December 16, 2015 02:18
How to i get to this syntax from Rails.??
<ul class="clearing-thumbs" data-clearing>
<li><a href="path/to/your/img"><img data-caption="caption here..." src="path/to/your/img-th"></a></li>
<li><a href="path/to/your/img"><img data-caption="caption 2 here..." src="path/to/your/img-th"></a></li>
<li><a href="path/to/your/img"><img data-caption="caption 3 here..." src="path/to/your/img-th"></a></li>
</ul>
<div class="fixed">
<nav class= "top-bar">
<ul class="title-area">
<li>
<h2><%= link_to image_tag("officialLogo-100x197.png", :size => "100x197", :alt => "" ) + "AppDomum", root_path %></h2>
</li>
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<p><%= @contact.message %></p>
<p>---------------------</p>
<p><%= ContactUs.require_name ? t('.sent_by_name', :email => @contact.email, :name => @contact.name) : t('.sent_by_contact_form', :email => @contact.email) %></p>
Error message:
Could not find i18n-0.6.1 in any of the sources (Bundler::GemNotFound)
Exception class:
PhusionPassenger::UnknownError
Application root:
/var/www/sandbox/appdomumsite
/usr/local/rvm/gems/ruby-2.0.0-rc1@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb 92 in `block in materialize'
1 /usr/local/rvm/gems/ruby-2.0.0-rc1@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb 85 in `map!'
Connecting to database specified by database.yml
Started GET "/" for 98.252.77.72 at 2013-04-16 00:06:28 -0700
Processing by HomeController#index as HTML
Completed 500 Internal Server Error in 5ms
ActiveRecord::StatementInvalid (Could not find table 'users'):
app/controllers/home_controller.rb:3:in `index'