Skip to content

Instantly share code, notes, and snippets.

@TXDynamics
TXDynamics / fund.rb
Created May 24, 2013 13:12
Ruby-Model-For-Legacy-DB
# == Schema Information
#
# Table name: sysdba.INF_FUND
#
# INF_FUNDID :string(12) not null, primary key
# CREATEUSER :string(12)
# CREATEDATE :datetime
# MODIFYUSER :string(12)
# MODIFYDATE :datetime
# FUND_CODE :string(32)
@TXDynamics
TXDynamics / investment.rb
Created May 24, 2013 18:06
Ruby Investment Item Model
# == Schema Information
#
# Table name: sysdba.INF_ACC_IA_INVESTMENT
#
# INF_ACC_IA_INVESTMENTID :string(12) not null
# INF_ACC_INVEST_ACCOUNTID :string(12) not null
# CREATEUSER :string(12)
# CREATEDATE :datetime
# MODIFYUSER :string(12)
# MODIFYDATE :datetime
@TXDynamics
TXDynamics / investment.rb
Created May 27, 2013 14:41
Sample-Investment-Model
# == Schema Information
#
# Table name: sysdba.INF_ACC_IA_INVESTMENT
#
# INF_ACC_IA_INVESTMENTID :string(12) not null
# INF_ACC_INVEST_ACCOUNTID :string(12) not null
# CREATEUSER :string(12)
# CREATEDATE :datetime
# MODIFYUSER :string(12)
# MODIFYDATE :datetime
@TXDynamics
TXDynamics / email_que.rb
Created May 27, 2013 15:01
Email queue created before emails are sent
# == Schema Information
#
# Table name: email_ques
#
# id :integer not null, primary key
# job_que_id :integer
# to_field :string(255)
# subject_field :string(255)
# body_field :text
# send_status :text
@TXDynamics
TXDynamics / login_form
Created June 5, 2013 02:42
Device Login form Sample
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<div>
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div><%= f.label :email %><br />
<%= f.email_field :email, :autofocus => true %></div>
@TXDynamics
TXDynamics / import_csv
Created June 5, 2013 20:45
Ruby on Rails: Import a csv file into a database and adding an additional static value column
file_path = 'public/uploads/' + filename
marketer = Marketer.find(marketer_id)
CSV.foreach(file_path, headers: true) do |row|
MarketerImport.create! row.to_hash.merge(new_user: marketer.slx_id)
end
@TXDynamics
TXDynamics / best-in-place-ajax-update
Created June 6, 2013 00:27
Ruby-Rails: Rest In Place Ajax Ruby Updater update field
<span id="fund_<%= fund.id %>_MARKETING_CODE" class="rest-in-place" data-url="/funds/<%= fund.id %>" data-object="fund" data-attribute="MARKETING_CODE">
<%= fund.MARKETING_CODE.blank? ? 'Click here to edit' : fund.MARKETING_CODE %>
</span>
@TXDynamics
TXDynamics / rails-scaffold-existing-model
Created June 10, 2013 21:30
Ruby Rails: Create Scaffold from Existing Model
rails g scaffold_controller Model
@TXDynamics
TXDynamics / kaminari-bootstrap.rb
Created June 12, 2013 01:54
Kaminari Pagination Bootstrap views install
rails generate kaminari:views bootstrap
@TXDynamics
TXDynamics / simple_form_boot-strap_quick_reference.rb
Created June 15, 2013 13:15
Simple_form Quick Reference Bootstrap Views
# standard input with with defined by span and a stylized hint and defined Lable
<%= f.input :listing_title, hint: '<strong>Pick a descriptive title to really sell your place!</strong>', input_html: { class: 'span7' }, label: 'Listing Title' %>
# Standard Input complete defaults pulled from the associated model
<%= f.input :listing_title %>
# Submit Button with modified bootstrap style and Text
<%= f.button :submit , :class => 'btn btn-medium btn-success', value: 'Post It!' %>
# Dynamic Dropdown Select Box using values from a model