Skip to content

Instantly share code, notes, and snippets.

View chintanparikh's full-sized avatar
🎯
Focusing

Chintan Parikh chintanparikh

🎯
Focusing
View GitHub Profile
category = FactoryGirl.create(:category)
section = FactoryGirl.create(:section, category: association(category))
ActiveRecord::Schema.define(:version => 20120609145912) do
create_table "categories", :force => true do |t|
t.string "name"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "sections", :force => true do |t|
t.string "name"
%h2 Categories
- @categories.each do |category|
%ul
%li
%h3= link_to category.name, [category]
%ul
- Category.find(category.id).sections.each do |section|
%li= link_to section.name, [category, section]
%h2= @category.name
- @category.sections do |section|
%ul
%li= link_to section.name, [@category, section]
when /^the section page for (.*)$/i
section = Section.find(:all, conditions: {name: $1})
[section.category, section]
when /^the category section page for "(.*)"$/i
category = Category.find_by_name($1)
category_sections_path(category)
wrong number of arguments (1 for 0) (ArgumentError)
./app/controllers/sections_controller.rb:3:in `index'
./features/step_definitions/web_steps.rb:45:in `/^(?:|I )am on (.+)$/'
features/viewing_sections.feature:16:in `And I am on the category section page for "Textbooks"'
resources :categories do
resources :sections do
get :index => 'category#show'
resources :listings
end
end
PetrescueAdmin::Application.routes.draw do
devise_for :users
root to: redirect("/users/sign_in")
resources :groups, only: [:new, :create, :show]
get 'rescue_directory' => 'groups#index'
get 'rescue_directory/:state' => 'groups#list_by_state'
resources :listings, only: [:index]
@chintanparikh
chintanparikh / gist:2970493
Created June 22, 2012 05:29
Sublime Text 2/Packages/GoToSpec/GoToSpec.py
import sublime, sublime_plugin, os, time
class GoToSpecCommand(sublime_plugin.WindowCommand):
def open_left(self, file):
self.window.open_file(file)
if self.window.active_group() == 0:
return
self.window.run_command('close')
self.window.run_command('set_layout',