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
def smush(array, container = []) | |
array.each do |element| | |
if element.is_a? Array | |
smush element, container | |
else | |
container << element | |
end | |
end | |
container |
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
I would like to locate a partial in the app/views dir to be shared by two name spaces. How can I link the missing partials, (lostees or others)/trees/tree.html.haml to trees/tree.html.haml? | |
# config/routes.rb | |
namespace :lostees do | |
resources :islands | |
end | |
namespace :others do |
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
namespace :users do | |
resources :clients do | |
scope 'applications', as: 'applications', klass: Application do | |
resources :submit_applications, only: [:update] | |
end | |
resources :applications | |
end | |
end | |
= form_for application, url: users_client_application_submit_application_path(client, application) do |f| |
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 Person < ActiveRecord::Base | |
attr_accessor :dont_set_name | |
def name | |
@name | |
end | |
def name=(attr) | |
@name = attr unless dont_set_name | |
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
str = '' | |
counter = 1 | |
ARGV.each do |a| | |
counter = counter + 1 | |
a.each_char do |char| | |
char = char.to_s.downcase | |
case char | |
when 'a' | |
str += '.-' | |
when 'b' |