Skip to content

Instantly share code, notes, and snippets.

View chrislerum's full-sized avatar

Chris Lerum chrislerum

View GitHub Profile
= form_for(@profile) do |f|
= f.hidden_field @hidden_field_name, :value => @hidden_field_value
= f.submit @button_message, class: "btn btn-success btn-sm pull-left btn-group-item", data: { confirm: @button_confirmation }
class User < ActiveRecord::Base
has_attached_file :avatar, :styles => {:thumb => '100x100>'}
end
###########
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :avatar_file_name
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:user => "root",
:password => "",
:database => "arvest"
)
class Employee < ActiveRecord::Base
end
@chrislerum
chrislerum / rules.md
Created September 15, 2012 18:00 — forked from radar/rules.md

Asking questions, the right way

When asking questions in the #rubyonrails channel, please follow these 12 simple rules. Can't count that high? The first 7 will get you in most people's good books.

  1. Do your research beforehand. Your question may be answerable with a quick Google search or by simply experimenting. If you're using a method in Rails, look it up in the API Docs or in the Official Guides.
  2. If you've tried Googling, explain what terms you've tried to use so people can better help you.
  3. Clearly explain what is happening and create a Gist (http://gist.github.com) or Pastie (http://pastie.org) of the code that is causing the problem you are encountering, as well as any useful output like stacktraces. A "Full Trace" as opposed to the default "Application Trace" is preferred. NO FAKE CODE. If you're under an NDA, we cannot help you with your problem. Go hire a consultant.
  4. **Do not use any service that is not Pastie or Gist
<soap:Envelope xmlns="http://www.w-w-i-s.com/hb/51" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" >
<soap:Header>
<Credentials>
<HMac>string</HMac>
<ClientID>AHHRV</ClientID>
<UserName>ariel1234</UserName>
<Password>worldwide1</Password>
</Credentials>
</soap:Header>
<soap:Body>
require 'rubygems'
gem 'savon', '=1.1.0'
require 'savon'
WSDL_URL = "https://testenv.w-w-i-s.com/hb/51/api.asmx?wsdl"
HMAC = 'string'
CLIENT_ID = 'AHHRV'
MAIN_HEADER = {
'Credentials' => {
'HMac' => HMAC,