Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
def get_queryset(self): | |
""" | |
Will get the queryset. | |
""" | |
forum_id = self.kwargs['forum_id'] | |
return Topic.objects.filter(forum__id=forum_id).order_by('-is_sticky', '-modified').select_related('last_post__topic', 'last_post__author', 'author') |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
= form_for([@forum, @topic]) do |f| | |
- if @topic.errors.any? | |
%div{id: 'error_explanation'} | |
%h2 | |
= pluralize(@topic.errors.count, "error") | |
prohibited this topic from being saved: | |
- for message in @topic.errors.full_messages | |
%li | |
= message |
require 'spec_helper' | |
describe "CreateTopics" do | |
it "creates topics" do | |
@forum = Forum.create(name: 'Ruby') | |
visit new_forum_topic_path, @forum.slug | |
fill_in "Name", with: "Test" | |
click_button "Submit" | |
end |
require 'spec_helper' | |
require 'faker' | |
feature 'Create user' do | |
scenario 'creates a user successfully with a valid username, email and password' do | |
register_with Faker::Internet.user_name, 'test123', 'test123', Faker::Internet.email | |
user_sees_success_message "Registered successfully!" | |
end | |
scenario 'notifies the user if his username is invalid' do |
FactoryGirl.define do | |
factory :category do | |
name 'Programming' | |
end | |
end |
Topic | |
is valid if all parameters match (FAILED - 1) | |
Failures: | |
1) Topic is valid if all parameters match | |
Failure/Error: build(:topic).should be_valid | |
ActiveRecord::RecordInvalid: | |
Validation failed: Username has already been taken | |
# C:in `object' |
= form_for([@forum, @topic]) do |f| | |
- if @topic.errors.any? | |
%div{class: 'alert'} | |
%h2 | |
= pluralize(@topic.errors.count, 'error') | |
prohibited this topic from being saved: | |
- for message in @topic.errors.full_messages | |
%li | |
= message |
= form_for(:user) do |f| | |
- if flash[:alert] | |
%div{class: 'alert'} | |
= flash[:alert] | |
= f.label :email | |
%div{class: 'field'} | |
= f.email_field :email |
Parameters: | |
{"_method"=>"put", | |
"authenticity_token"=>"eDv4pcLTU0m3os+7OImIOdNQxouyQoSb3FojGMXMNh8=", | |
"forum_id"=>"ruby", | |
"topic_id"=>"asdasdasdasdasd"} |