Skip to content

Instantly share code, notes, and snippets.

/vendor/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:125 in "==="
/vendor/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:125 in "split"
/vendor/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:211 in "parse"
/vendor/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:747 in "parse"
/vendor/bundle/ruby/2.1.0/gems/carrierwave_direct-0.0.14/lib/carrierwave_direct/uploader.rb:64 in "key"
/vendor/bundle/ruby/2.1.0/gems/carrierwave_direct-0.0.14/lib/carrierwave_direct/uploader.rb:81 in "has_key?"
/vendor/bundle/ruby/2.1.0/gems/carrierwave_direct-0.0.14/lib/carrierwave_direct/mount.rb:33 in "has_upload_upload?"
/app/models/document.rb:27 in "set_name"
/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7.1/lib/active_support/callbacks.rb:424 in "block in make_lambda"
/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.7.1/lib/active_support/callbacks.rb:160 in "call"
class window.KittenManager
actions:
hunting:
state: false
time_interval: null
parchmenting:
state: false
time_interval: null
manuscripting:
state: false
<% if @post.errors.any? %>
var errors = '';
<% @comment.errors.full_messages.each do |error| %>
errors.append("<%= escape_javascript( error ) %>\n");
<% end %>
alert(errors);
<% else %>
$('#posts').prepend('<%=j render 'chapters/posts/post', {:post => @post} %>')
<% end %>
<% if @post.errors.any? %>
var errors = '';
<% @comment.errors.full_messages.each do |error| %>
errors.append("<%= escape_javascript( error ) %>\n");
<% end %>
alert(errors);
<% else %>
$('#posts').prepend('<%=j render 'chapters/posts/post', {:post => @post} %>')
<% end %>
@arjan0307
arjan0307 / conversation.rb
Created March 20, 2012 15:29
Nested forms
class Conversation < ActiveRecord::Base
has_many :messages
has_many :participants
has_many :users, :through => :participants
accepts_nested_attributes_for :messages
end
@arjan0307
arjan0307 / devise.rb
Created April 4, 2012 14:19
E-mails with empty bodies, by devise
# config/initializers/devise.rb
config.mailer = DeviseMailer
@posts = @profile.posts # []
@profile.posts.build
@posts # array containing a single post
@arjan0307
arjan0307 / routes
Created May 17, 2012 15:24
Nested routes without parent routes
# How to get just the comment routes, and not the post routes
resources :posts do
resources :comments
end
@arjan0307
arjan0307 / routes
Created May 17, 2012 15:24
Nested routes without parent routes
# How to get just the comment routes, and not the post routes
resources :posts do
resources :comments
end
@arjan0307
arjan0307 / development.rb
Last active October 9, 2015 10:28
Gmail email rails
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => 'ommitted!',
:password => 'ommitted!',
:authentication => 'plain',
:enable_starttls_auto => true
}