diff --git a/Snippets/named_scope lambda.tmSnippet b/Snippets/named_scope lambda.tmSnippet new file mode 100644 index 0000000..bc5329c --- /dev/null +++ b/Snippets/named_scope lambda.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + named_scope :name, lambda { |${1:param}| { :conditions => ${3:['${4:${5:field} = ?}', ${6:$1}]} } } + + name + named_scope lambda + scope + source.ruby.rails + tabTrigger + ncl + uuid + 4E286CB4-069E-474C-A970-95216FE7DE95 + + diff --git a/Snippets/named_scope.tmSnippet b/Snippets/named_scope.tmSnippet new file mode 100644 index 0000000..111f77d --- /dev/null +++ b/Snippets/named_scope.tmSnippet @@ -0,0 +1,17 @@ + + + + + content + named_scope :name${1:, :joins => :${2:table}}, :conditions => ${3:['${4:${5:field} = ?}', ${6:true}]} + + name + named_scope + scope + source.ruby.rails + tabTrigger + nc + uuid + 1CB65A0D-4FEC-4438-9B4F-8B0BD13FB875 + + diff --git a/Support/bin/fixture_auto_complete.rb b/Support/bin/fixture_auto_complete.rb index 4765203..04a1a94 100644 --- a/Support/bin/fixture_auto_complete.rb +++ b/Support/bin/fixture_auto_complete.rb @@ -52,6 +52,11 @@ def filter_fixtures(fixtures, filter) end end +# 'foo' => ':foo' and 'foo-bar' => ':"foo-bar"' +def symbolize_name(name) + name.to_sym.inspect +end + filetype, start_line_gap, ref, filter = parse_line filter = "" if filter.nil? foreign_fixtures = load_referenced_fixture_file(ref).keys @@ -74,6 +79,6 @@ def filter_fixtures(fixtures, filter) if filetype == :fixture print "#{start_line_gap}#{ref}: #{selected_fixture}" else - print "#{start_line_gap}@#{Inflector.singularize ref} = #{ref}(:#{selected_fixture})" + print "#{start_line_gap}@#{Inflector.singularize ref} = #{ref}(#{symbolize_name selected_fixture})" end end diff --git a/Syntaxes/Ruby on Rails.plist b/Syntaxes/Ruby on Rails.plist index b72544f..6f7b452 100644 --- a/Syntaxes/Ruby on Rails.plist +++ b/Syntaxes/Ruby on Rails.plist @@ -265,7 +265,7 @@ match - \b(after_create|after_destroy|after_save|after_update|after_validation|after_validation_on_create|after_validation_on_update|before_create|before_destroy|before_save|before_update|before_validation|before_validation_on_create|before_validation_on_update|composed_of|belongs_to|has_one|has_many|has_and_belongs_to_many|validate|validate_on_create|validates_numericality_of|validate_on_update|validates_acceptance_of|validates_associated|validates_confirmation_of|validates_each|validates_format_of|validates_inclusion_of|validates_exclusion_of|validates_length_of|validates_presence_of|validates_size_of|validates_uniqueness_of|attr_protected|attr_accessible|attr_readonly)\b + \b(named_scope|after_create|after_destroy|after_save|after_update|after_validation|after_validation_on_create|after_validation_on_update|before_create|before_destroy|before_save|before_update|before_validation|before_validation_on_create|before_validation_on_update|composed_of|belongs_to|has_one|has_many|has_and_belongs_to_many|validate|validate_on_create|validates_numericality_of|validate_on_update|validates_acceptance_of|validates_associated|validates_confirmation_of|validates_each|validates_format_of|validates_inclusion_of|validates_exclusion_of|validates_length_of|validates_presence_of|validates_size_of|validates_uniqueness_of|attr_protected|attr_accessible|attr_readonly)\b name support.function.activerecord.rails diff --git a/info.plist b/info.plist index 16635e8..460c8fa 100644 --- a/info.plist +++ b/info.plist @@ -134,6 +134,16 @@ name link_to + 3DF64504-EE4E-4EA2-BE81-80D8DE446656 + + items + + 1CB65A0D-4FEC-4438-9B4F-8B0BD13FB875 + 4E286CB4-069E-474C-A970-95216FE7DE95 + + name + Scopes + 4D3A01D4-ACA8-49AF-B1DD-428B823964C3 items @@ -193,6 +203,7 @@ ------------------------------------ CD88AD5A-7F20-4D4C-882A-31E1CDFDFD16 B89CD2E9-4271-41BB-8AF6-A747553D99EB + 3DF64504-EE4E-4EA2-BE81-80D8DE446656 A26B8A37-FAC0-4F44-B18D-6BE30D84F27E 7D9194BB-2BCC-4E20-84C8-0990B77D5515 @@ -836,6 +847,8 @@ A017AB39-A875-40DC-8ACF-7E3551057CA0 FE430ECD-5D40-4D95-A73B-F064C73992DE 59CD3A41-8164-4FB4-B462-D7ACE86BCDBF + 1CB65A0D-4FEC-4438-9B4F-8B0BD13FB875 + 4E286CB4-069E-474C-A970-95216FE7DE95 D975E5C1-42C2-40F1-8960-0DA533B18113 36E2A3EE-E9CC-4B7F-A4CF-AFAF970B8699 38D5CA05-E219-4399-A244-609AF40B1D0B