Sublime Forum

Please, fix snippet

#1

hello dear Developers!

i find, when i working with .rb files (ruby), ST3 have snippet “create controller class” (type cla…) for Ruby on Rails. This snipeet now views as:

class ModelController < ApplicationController
  before_filter :find_model

  

  private
  def find_model
    @model = Model.find(params[:id]) if params[:id]
  end
end

but, hook before_filter is old and deprecated (unofficial). See this: Filters on Controllers (ROR Guides)

We must use before_action hook in controllers.

with respect, Yury Izotov. Sorry for bad English, i Russian and writes it without translate service (practicing)

0 Likes

#2

Hey Yury, welcome to the forum!

You can update the snippets yourself by either sending a pull request:

Or just go to Preferences -> Browse packages and create a new file: Rails/Snippets/Create-controller-class.sublime-snippet that will have your code instead.

Cheers!

3 Likes

#3

The best place to report an issue like this will be at https://github.com/sublimehq/Packages/issues. If you want to create a merge request to make the fix yourself, here is the source file for the snippet: https://github.com/sublimehq/Packages/blob/master/Rails/Snippets/Create-controller-class.sublime-snippet

1 Like

#4

thanx! I use Github in future for this question (reports,fixes) primary. Thank you! I create PR there

Cheers!

0 Likes

#5

thanx, i go to you instruction in future.

With respect, Yury Izotov

0 Likes