Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't create plugin with Rails 3.2?

i've a problem with rails in latest version. I 've create a new app (rails new MyProject) but i don't have script/generate, only have script/rails and when i type

ruby ./script/rails generate plugin my_plugin
"Could not find generator plugin.".

Do you have any idea how generate plugin template? it's possible to create plugin without this command?

PS: i'm using Rails 3.2.1 with ruby 1.8.7 [universal-darwin11.0]

like image 873
0xBAADF00D Avatar asked Feb 19 '12 10:02

0xBAADF00D


1 Answers

The plugin generator has been removed with the release of Rails 3.2.0. See the changelog here. Now you can use the following command:

rails plugin new my_plugin

But be careful because you should run the command outside of the project. It creates a whole plugin structure with its own Gemfile. So, after created the plugin, you can use it in your Rails app adding it to the Gemfile with the path option. Something like:

gem 'my_plugin', path: '/path/to/my_plugin'

I just read that you're using Ruby 1.8.7. Please consider to upgrade to Ruby 1.9.3. Rails 3.2 is the last version of the framework that supports Ruby 1.8.7.

like image 125
lucapette Avatar answered Oct 22 '22 03:10

lucapette