If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new # guest user | |
can [:read, :update], User do |user_profile| | |
user_profile.id == user.id | |
end | |
If you haven't already set your NPM author info, now you should:
npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"
npm adduser
<%= form_for(@category, :html => { :class => "form-horizontal" }, :remote => true) do |f| %> | |
<% if @category.errors.any? %> | |
<div id="error_explanation"> | |
<h2><%= pluralize(@category.errors.count, "error") %> prohibited this category from being saved:</h2> | |
<ul> | |
<% @category.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> |
def self.import(file) | |
spreadsheet = open_spreadsheet(file) | |
spreadsheet.sheets.each do |sheet| # looping all sheet | |
spreadsheet.default_sheet = "#{sheet}" # picking current sheet as default to be processing | |
header = spreadsheet.row(1) | |
(2..spreadsheet.last_row).each do |i| # looping all excel data | |
row = Hash[[header, spreadsheet.row(i)].transpose] | |
if row["CATEGORY"].present? | |
category_id = Category.find_by_name(row["CATEGORY"]).try(:id) |
def show | |
@sale = Sale.find(params[:id]) | |
respond_to do |format| | |
format.html # show.html.erb | |
format.json { render json: @sale } | |
format.pdf do | |
pdf = SaleIndividualPdf.new(@sale.id, view_context, ApplicationController.helpers.get_company_identity) | |
send_data pdf.render, filename: "#{I18n.t 'sale.sales_invoice'} #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}.pdf", | |
type: "application/pdf", :disposition => "inline" |
class ReportController < ApplicationController | |
def get_data | |
@customers = Customer.order(:name) | |
end | |
def sale | |
@sales = Sale | |
.where("EXTRACT(MONTH FROM sales.transaction_date)=EXTRACT(MONTH FROM CURRENT_DATE) AND EXTRACT(YEAR FROM sales.transaction_date)=EXTRACT(YEAR FROM CURRENT_DATE) AND sales.status IN (1)") | |
.order(:created_at).reverse_order | |
.pagination(params[:page]) |
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" } |