Skip to content

Instantly share code, notes, and snippets.

@Znow
Created December 23, 2011 10:03
Show Gist options
  • Save Znow/1513778 to your computer and use it in GitHub Desktop.
Save Znow/1513778 to your computer and use it in GitHub Desktop.
error
Started GET "/admin/investors/2" for 192.168.233.1 at 2011-12-23 11:01:45 +0100
Processing by Admin::InvestorsController#show as HTML
Parameters: {"id"=>"2"}
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Investor Load (0.3ms) SELECT "investors".* FROM "investors" WHERE "investors"."id" = ? LIMIT 1 [["id", "2"]]
Completed 406 Not Acceptable in 52ms
class Admin::InvestorsController < AdminController
def index
@investors = Investor.all
end
def show
@investor = Investor.find(params[:id])
@stocks = @investor.stocks
#@stocks = @investor.investors_stocks.stocks
respond_to do |format|
format.pdf do
pdf = InvestorPdf.new(@investor, view_context)
send_data pdf.render, filename: "investor_#{@investor}.pdf",
type: "application/pdf",
disposition: "inline"
end
end
end
def new
@investor = Investor.new
end
def create
@investor = Investor.new(params[:investor])
if @investor.save
redirect_to admin_investors_path, :notice => "Investor was successfully created."
else
render :new
end
end
def edit
@investor = Investor.find(params[:id])
end
def update
@investor = Investor.find(params[:id])
if @investor.update_attributes(params[:investor])
redirect_to @investor, :notice => "Investor was successfully updated."
else
render :edit
end
end
def destroy
@investor = Investor.find(params[:id])
@investor.destroy
redirect_to admin_investors_path, :notice => "Investor was successfully deleted."
end
end
%h3= @investor.name
%h3 Aktie udvikling
%table
%tr
%th Værdi
%th Måned
%th År
- @stocks.each do |s|
%tr
%td= s.value
%td= s.month
%td= s.year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment