This file contains hidden or 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
module ParserModule | |
data = nil | |
pages = nil | |
def data=d | |
data = d | |
end | |
def data | |
data |
This file contains hidden or 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
module ParserModule | |
attr :pm_data, :pm_pages | |
def pages | |
if @pm_pages.nil? | |
@pm_pages = @pm_data.split /^\d{4}\s*$/ | |
end | |
@pm_pages | |
end |
This file contains hidden or 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
<fieldset> | |
<legend><%= form_legend %></legend> | |
<div class='control-group<%= " error" if @user.errors.has_key?(:email) %>'> | |
<label class='control-label'>Email</label> | |
<div class='controls'> | |
<%= f.text_field :email, :class => 'input-xlarge' %> | |
<% if @user.errors.has_key?(:email) %> | |
<span class='help-inline'>Email <%= @user.errors.get(:email).first %></span> |
This file contains hidden or 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
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, | |
# :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :first_name, :last_name, :organization, :email, :password, :password_confirmation, :remember_me, :is_admin, :plan |
This file contains hidden or 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
{"utf8"=>"✓", | |
"_method"=>"put", | |
"authenticity_token"=>"...", | |
"user"=>{"email"=>"[email protected]", | |
"password"=>"[FILTERED]", | |
"first_name"=>"Bob", | |
"last_name"=>"Jones", | |
"subscription"=>{"plan_id"=>"5"}}, | |
"password_confirmation"=>"[FILTERED]", | |
"commit"=>"Update User", |
This file contains hidden or 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
ActiveRecord::RecordNotSaved in Admin::UsersController#update | |
Failed to remove the existing associated subscription. The record failed to save when after its foreign key was set to nil. |
This file contains hidden or 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
module Draper | |
class CollectionDecorator | |
delegate :current_page, :total_pages, :limit_value, :model_name, :total_count, :offset_value, :last_page? | |
end | |
end |
This file contains hidden or 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 'html2markdown' #gem install html2markdown | |
dirs = %w(_pages _posts) | |
class String | |
def word_wrap(line_width = 120) | |
self.split("\n").collect do |line| | |
line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line | |
end * "\n" | |
end |
This file contains hidden or 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
class Widget < ActiveRecord::Base | |
include Thingable | |
end |
This file contains hidden or 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
# fetchs SIB Campaigns | |
def fetch | |
# update/create | |
campaign_records.each do |record| | |
shoot = Shoot.find_or_initialize_by(campaign_id: record[:id]) | |
unless shoot.update(record) | |
# the data was invalid, so the shoot wasn't saved, do something about that here | |
end | |
end |