Create New Method based on method signature

Hello,

Is there a way to refactor or generate the method based on the signature?

I often write skeleton code, and then have to go through to create the methods manually.

Presently, RubyMine is able to identify that the method doesn't exist on a class/model/controller...etc...so it should be a stretch (I think) to simply generate the method...

So if I have a model:

class Student


end

and in my controller, I write:


class StudentsController


  def create

    name = params[:name]

    student = Student.new_student_with_name(name) if is_valid?(name)

    ...

  end

end


Student#new_student_with_name(name) doesn't exist...and I'd like a way to simply generate the method skeleton.

Thanks
H

4 comments
Comment actions Permalink

Hello harold,

This feature exists in RubyMine 2.0. Simply press Alt-Enter on the new_student_with_name
reference, select "Create Method" from the quickfix menu, and it will create
the method for you.

Is there a way to refactor or generate the method based on the
signature?

I often write skeleton code, and then have to go through to create the
methods manually.

Presently, RubyMine is able to identify that the method doesn't exist
on a class/model/controller...etc...so it should be a stretch (I
think) to simply generate the method...

So if I have a model:

class Student

end

and in my controller, I write:
+
+
class StudentsController
def create
name = params[:name]
student = Student.new_student_with_name(name) if
is_valid?(name)
...
end

end

Student#new_student_with_name(name) doesn't exist...and I'd like a
way to simply generate the method skeleton.

Thanks
H
---
Original message URL:
http://www.jetbrains.net/devnet/message/5251282#5251282

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Thanks!!!
This works!

In a future version, I'd love to see the params being added automagically too

0
Comment actions Permalink

Hi Harold,

We've already fix it, fix will be available in RubyMine 2.0 bug fix update

0

Please sign in to leave a comment.