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 ReportsController < ApplicationController | |
def index | |
@reports = Report.all | |
end | |
def show | |
@report = @technician.report.find(params[:id]) | |
end | |
def new |
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 UploadsController < ApplicationController | |
def create | |
... | |
@upload.shape = "photo" | |
... | |
if @upload.save | |
... | |
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
class Upload < ActiveRecord::Base | |
belongs_to :uploadable, :polymorphic => true | |
attr_accessible :uploadable_id, :uploadable_type, :attachment, :shape, :description | |
# Make :parent_type available for Paperclip :path & :url options. | |
# Path on S3 should contain the parent class (e.g. "member") for | |
# better readability. | |
Paperclip.interpolates :parent_type do |attachment, style| |
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
Here we get :parent_type --> works √ | |
Paperclip.interpolates :parent_type do |attachment, style| | |
attachment.instance.uploadable_type.downcase | |
end | |
Here, :parent_type works in :path => but not in Proc, how do I solve this? | |
has_attached_file :attachment, | |
:path => ":class/:parent_type/:id/:style.:extension", |
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
module Paperclip | |
class Attachment | |
def self.default_options | |
@default_options ||= { | |
:url => ":attachment/:id/:style.:extension", | |
:path => ":rails_root/public:url", | |
:s3_credentials => "#{Rails.root}/config/s3.yml", | |
:storage => :s3, | |
:styles => {}, | |
:processors => [:thumbnail], |
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 Game < ActiveRecord::Base | |
has_many :photos, :as => :picturable, :dependent => :destroy | |
accepts_nested_attributes_for :photos, :allow_destroy => true, :reject_if => lambda { |a| a[:picture].blank? } | |
end | |
should be outsourced into a module like | |
=> /lib/attachment.rb |
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
# Change prefix key to Ctrl+a | |
unbind C-b | |
set -g prefix C-a | |
# Last active window | |
unbind l | |
bind C-a last-window | |
# Copy mode | |
unbind [ |
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
<!-- | |
\begin{figure}[htbp] | |
\centering | |
\setlength{\fboxsep}{0pt}% | |
\setlength{\fboxrule}{1pt}% | |
\fbox{\includegraphics[keepaspectratio,width=\textwidth,height=\dimexpr\textheight-2\baselineskip\relax]{../Grafiken/Grafik_Diagnostik_Erkenntnisinteresse.jpg}} | |
\caption{Erkenntnisinteressen der Diagnostik} | |
\label{grafik_diagnostik_erkenntnisinteresse} | |
\smallskip | |
\footnotesize |
NewerOlder