# config/initializers/simple_form.rb
SimpleForm.setup do |config|
config.wrappers :default,
:class => 'input',
:hint_class => 'field_with_hint',
:error_class => 'field_with_errors' do |b|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spec/support/authentication.rb | |
def login!(user = false) | |
@current_user = user | |
controller.stub!(:current_user).and_return(@current_user) | |
view.stub!(:current_user).and_return(@current_user) | |
session[:user_id] = @current_user.id | |
end | |
def login_as_seller!(seller = Seller.make(:valid)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is a hack to get the subdomain part of routing working | |
# I added it in for Rails 3.0.1 | |
module ActionDispatch | |
module Routing | |
class RouteSet | |
class Generator | |
alias_method :initialize_before, :initialize | |
def initialize(options, recall, set, extras = false) | |
initialize_before(options, recall, set, extras) | |
@recall.delete(:subdomain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- app | |
- controllers | |
- seller # namespaced like an admin but for sellers | |
whatevere.rb # must have a file in here | |
- models | |
seller.rb | |
$ rspec spec | |
Exception encountered: #<RuntimeError: Already memoized foobar> # foobar is inside models/seller.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
require 'twitter' | |
require 'csv' | |
csv = CSV.open("./output.csv", "w") | |
# CSV Headers | |
csv << ["Winery Name", "Twitter Title", "Twitter Link", "Facebook Title", "Facebook Link"] | |
#wineries = ["novavitawines", "Wicks Estate Wines", "Izway Wines"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'mechanize' | |
require 'csv' | |
require 'fileutils' | |
source_csv = ARGV[0] || "./wineries.csv" | |
max_searchs = ARGV[1] || 100 | |
def google_site_search(site, query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
require 'csv' | |
CSV.foreach('wineries.csv', "r") do |row| | |
puts row.first | |
end |
https://github.com/plataformatec/simple_form
http://railscasts.com/episodes/234-simple-form-revised
# Gemfile
gem 'simple_form'
OlderNewer