Skip to content

Instantly share code, notes, and snippets.

<%= select "item_tax_data", "item_tax_data",
@tax_array.each_with_index.map {
|jsondata, index|
[jsondata["abbreviation"] + " - " + jsondata["tax_percentage"].to_s + "%",
jsondata.to_json]}, :selected => item["tax_category"].to_json
%>
<%= select "item_tax_data", "item_tax_data",
@tax_array.each_with_index.map {
|jsondata, index|
[jsondata, index]}, :selected => item["taxitem"]
%>
<%= select "currency", "currency",
Country.all.each_with_index.map {
|country, index|
[country["currency_code"],
country["currency_code"]]}, :selected => @invoice["data"]["currency"]
%>
<%= form_for(@vendor) do |f| %>
<% if @vendor.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@vendor.errors.count, "error") %> prohibited this vendor from being saved:</h2>
<ul>
<% @vendor.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<!DOCTYPE html>
<html>
<head>
<title>Megaaccounts</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
<p class="notice"><%= notice %></p>
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
#gem 'rails', '4.0.2'
#gem 'rails', git: 'https://github.com/inopinatus/rails', branch: 'hstore_arrays_fix'
#gem 'rails', '4.1.0.rc1'
gem "rails", github: "rails/rails", branch: "4-0-stable"
# Use postgresql as the database for Active Record
gem 'pg'
<%= form_for(@country) do |f| %>
<% if @country.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@country.errors.count, "error") %> prohibited this country from being saved:</h2>
<ul>
<% @country.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery.modal
//= require turbolinks
//= require_tree .
//= require select2
<%= form_for(@country) do |f| %>
<% if @country.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@country.errors.count, "error") %> prohibited this country from being saved:</h2>
<ul>
<% @country.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
$(document).ready ->
state_cache = {}
$('#invoice_product_code_invoice_product_code').change ->
invoice_product_code = $(this).val()
console.log invoice_product_code
switch invoice_product_code
when 'INVPRODA'
$('#product_name').val('Product A');
when 'INVPRODB'
$('#product_name').val('Product B');