This project is archived and is in readonly mode.
Rails generate skip and force options not working
Reported by MarcRic | November 29th, 2010 @ 02:10 AM | in 3.x
Hi,
I have created this model first:
rails generate model customer name:string description:text phone:string rating:string
It works fine.
Then I try to generate a scaffold for customer this way:
rails generate scaffold customer name:string description:text phone:string rating:string
Which brings me the following:
Another migration is already named create_customers: E:/AA-eGenial/crm/db/migrate/20101128212832_create_customers.rb
Then I have tried the skip option this way:
rails generate scaffold customer name:string description:text phone:string rating:string -s
And this way:
rails generate scaffold customer name:string description:text phone:string rating:string -skip
rails generate scaffold customer name:string description:text phone:string rating:string --skip
All of them still bring me the same error.
The same occurs with the force option.
Regards.
P.S.:
It works with the --no-migration option !
Comments and changes to this ticket
-
Aditya Sanghi November 29th, 2010 @ 10:23 AM
- Importance changed from to Low
I'm inclined to reject this ticket since --skip or --force are not meant to skip or force the migration which is a new file (due to the timestamp). The correct way to do this is to use the --no-migration option. I'll leave it open for a short while longer to give change to others to chime in.
-
MarcRic November 29th, 2010 @ 10:58 AM
Hi,
I'm inclined to agree with you, but, on the other hand the help gives the impression that the --skip and --force options are provided to achieve that:
General options:
-f, [--force] # Overwrite files that already exist -s, [--skip] # Skip files that already existAnd the --no-migration option was not present in the help.
So, there is a problem. If it is not in the options, it is in the help.
Regards.
-
Aditya Sanghi November 29th, 2010 @ 01:28 PM
I see where you're coming from.
I ran 'rails g scaffold --help' and at the bottom --migration option is listed.
This option implicitly provides --no-migration option as well. It is not immediately clear that this option is available unless you are very familiar with how general options parsing frameworks work.
Perhaps you can suggest what the help text for --migration should read so that it is clear that -no-migration is also available.
-
MarcRic November 29th, 2010 @ 07:13 PM
OK,
I have missed the --migration option in the first place, but not only the --no-migration option is clearly available, but the original questioning is IMHO, right.
Let's assume, someone who asks for help, will not be familiar with how general options parsing framework works in the first place.
Secondly, if you receive an error message like:
Another migration is already named create_customers: E:/crm/db/migrate/20101128212832_create_customers.rb
And you see an option like this:
-s, [--skip] # Skip files that already exist
What will you think you should do?
Following the same perspective, given that I have created the model not only the migration, my first attempt was to use both:
--no-model --no-migration
Only a few minutes later after more tests, it becomes clear that the --no-model option was not necessary...
Well, at this point, I don't know if there is only a matter of clearing the text in the help screen or how general options parsing framework works!
Why it does complain about the migration file, but not about the model?
Regards.
-- MarcRic
www.marcric.com
http://marcricblog.blogspot.com/
http://www.traineronrails.com/
http://groups.google.com.br/group/riorubyrails -
rails March 5th, 2011 @ 12:00 AM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails March 5th, 2011 @ 12:00 AM
- State changed from open to stale
-
Dan Pickett March 13th, 2011 @ 05:10 PM
- Milestone set to 3.x
MarcRic,
Do you feel as though documenting the --no-migration option in help would help to clarify this issue, and maybe adding a caveat to the --skip help text that it will not skip existing migrations?
If so, would you be willing to supply a patch for this?
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>