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
| has_and_belongs_to_many :assemblies, -> { | |
| order(:name) | |
| } | |
| # ActiveRecord::StatementInvalid: SQLite3::SQLException: | |
| # no such column: assemblies.name: | |
| # SELECT "assemblies".* | |
| # FROM "assemblies" | |
| # INNER JOIN "assemblies_parts" | |
| # ON "assemblies"."id" = "assemblies_parts"."assembly_id" |
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
| # app/models/assembly.rb | |
| class Assembly < ActiveRecord::Base | |
| has_and_belongs_to_many :parts | |
| translates :name | |
| end | |
| # app/models/part.rb | |
| class Part < ActiveRecord::Base | |
| has_and_belongs_to_many :assemblies, -> { | |
| order('assembly_translations.name asc') |
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
| # -*- encoding : utf-8 -*- | |
| require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
| describe '#render_flash full stack integration' do | |
| controller do | |
| def escaped_string | |
| flash.now[:escaped] = "<foo>" | |
| render :inline => <<-EOF.strip_heredoc.html_safe | |
| <%= render_flash(flash[:escaped]) %> | |
| EOF |
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
| # A | |
| class TrackThing | |
| # The module can either be inline, or in its own file | |
| module TranslatedConstants | |
| def track_types | |
| { 'request_updates' => _('Individual requests'), | |
| 'all_new_requests' => _('Many requests') } | |
| end | |
| 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
| request = FactoryGirl.create(:info_request, :user => User.last) | |
| mail = RequestMailer.fake_response(request, request.user, 'Plz clarify', nil, nil) | |
| request.receive(mail, mail.encoded, true) | |
| event = request.log_event("status_update", | |
| { :user_id => request.user.id, | |
| :old_described_state => request.described_state, | |
| :described_state => 'waiting_clarification', |
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
| diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb | |
| index 8eec4f5..0e1cf4d 100644 | |
| --- a/activerecord/lib/active_record/associations/belongs_to_association.rb | |
| +++ b/activerecord/lib/active_record/associations/belongs_to_association.rb | |
| @@ -10,7 +10,9 @@ module ActiveRecord | |
| def replace(record) | |
| raise_on_type_mismatch!(record) if record | |
| - update_counters(record) | |
| + # PATCH |
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
| # Option A | |
| # - Always send a notification if something looks like spam | |
| # - If we have anti spam enabled, block the action unless the user is confirmed not spam | |
| if AlaveteliSpamTermChecker.new.spam?(params[:comment][:body]) | |
| if send_exception_notifications? | |
| e = Exception.new("Possible spam annotation from user #{@user.id}") | |
| ExceptionNotifier.notify_exception(e, :env => request.env) | |
| end | |
| if AlaveteliConfiguration.enable_anti_spam && !@user.confirmed_not_spam? |
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
| # ~/.tmuxinator/alaveteli-theme.yml | |
| <% theme_name = @args[0] %> | |
| name: <%= theme_name %> | |
| startup_window: <%= theme_name %> | |
| root: ~ | |
| windows: | |
| - <%= theme_name %>: | |
| root: ~/Code/alaveteli-themes/<%= theme_name %> |
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
| # Upload | |
| rsync -av -e "ssh -A JUMP_HOST ssh" FILE_TO_SEND DEST_HOST:/home/gareth/ | |
| # Download | |
| rsync -av -e "ssh -A JUMP_HOST ssh" DEST_HOST:~/FILE_TO_DOWNLOAD ~/Downloads/ |
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
| $ be rspec spec/models/outgoing_message_spec.rb:33 | |
| Run options: include {:locations=>{"./spec/models/outgoing_message_spec.rb"=>[33]}} | |
| Randomized with seed 62702 | |
| From: /home/vagrant/alaveteli/app/models/outgoing_message.rb @ line 81 OutgoingMessage.fill_in_salutation: | |
| 78: def self.fill_in_salutation(text, public_body) | |
| 79: val = text.gsub(Template::BatchRequest.placeholder_salutation, | |
| 80: default_salutation(public_body)) |