Re: [Rails] hii friends,,,,,i m new to rails......i think there is a problem in destroy command .

61 views
Skip to first unread message

Colin Law

unread,
Aug 16, 2012, 3:42:54 PM8/16/12
to rubyonra...@googlegroups.com
On 16 August 2012 06:03, Fahim Patel <paf...@gmail.com> wrote:
> let me explain this problem ........
> -------------------rails destroy----------------------------this command
> destroy model,scaffold etc .....
> problem is that if a model or other structure is exist than ,this command
> will destroy all the related file to it.......good ..till now no
> problem...........
> but problem is that if a model etc is not exist than till this command
> remove the file ...it should not be done.....there is no such a file name
> exist..........
> some error or exception should be execute at this time ....
>
> i think this a problem???
> if not than expalin me..........

I am not sure what you are saying. Can you post an example and the
result and explain what you think should happen. Run the command and
copy and paste the result here. Showing an example is always better
than trying to explain it in words in a languaget that is not your
first language.

Colin

AmateurCoder

unread,
Aug 16, 2012, 4:09:07 PM8/16/12
to rubyonra...@googlegroups.com

Are you saying to run rails destroy model foo and foo doesn't exist then you should get an error or exception message?  If you try this on the command line rails destroy model foo, it will run the opposite of the generate command; however, nothing ever existed, so can't see the harm.


On Thursday, August 16, 2012 12:03:47 AM UTC-5, Fahim Patel wrote:
let me explain this problem ........
-------------------rails destroy----------------------------this command destroy model,scaffold etc .....
problem is that if a model or other structure is exist than ,this command will destroy all the related file to it.......good ..till now no problem...........
but problem is that if a model etc is not exist than till this command remove the file ...it should not be done.....there is no such a file name exist..........
some error or exception should be execute at this time ....

i think this a problem???
if not than expalin me..........

Regards 
Fahim Babar Patel

Bill Walton

unread,
Aug 16, 2012, 5:12:38 PM8/16/12
to rubyonra...@googlegroups.com

The behaviour is consistent with other commands.   If, for example, you run 'rake db:migrate' and there are no migrations that need to be run, the task simply returns you to the command line without comment.  One might make the argument that it _should_ say something like 'there are no migrations that need to be run.'  Or one might start submitting patches and see what the community thinks ;-)

Best regards,
Bill

 
Regards 
Fahim Babar Patel

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/uAJe7mwsZkEJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Fahim Patel

unread,
Aug 17, 2012, 1:19:52 AM8/17/12
to rubyonra...@googlegroups.com
thanks for reply.....let me explain ....

there is no such a  testing model present
 rails destroy model testing
      invoke  active_record
      remove    migration.rb
      remove    app/models/testing.rb
      invoke    rspec
      remove      spec/models/testing_spec.rb
      invoke      factory_girl
      remove        spec/factories/testings.rb


but it is still removing files.....

one more example
rails destroy controller testing
      remove  app/controllers/testing_controller.rb
      invoke  erb
      remove    app/views/testing
      invoke  rspec
      remove    spec/controllers/testing_controller_spec.rb
      invoke  helper
      remove    app/helpers/testing_helper.rb
      invoke    rspec
      remove      spec/helpers/testing_helper_spec.rb
      invoke  assets
      invoke    coffee
      remove      app/assets/javascripts/testing.js.coffee
      invoke    scss
      remove      app/assets/stylesheets/testing.css.scss

there is no testing controller prsent.....
this thing is happen with all directory structure....
scaffold also  do the same thing......

there should be any exception or error ??????????

On Thursday, August 16, 2012 10:33:47 AM UTC+5:30, Fahim Patel wrote:
let me explain this problem ........
-------------------rails destroy----------------------------this command destroy model,scaffold etc .....
problem is that if a model or other structure is exist than ,this command will destroy all the related file to it.......good ..till now no problem...........
but problem is that if a model etc is not exist than till this command remove the file ...it should not be done.....there is no such a file name exist..........
some error or exception should be execute at this time ....

i think this a problem???
if not than expalin me..........

Regards 
Fahim Babar Patel

Fahim Patel

unread,
Aug 21, 2012, 1:51:18 AM8/21/12
to rubyonra...@googlegroups.com
i am waiting for ur reply Rails Community...can any one tell that this issue is problem or not?????i think it is a problem.......some exception should be thrown or any message........
this command removing the files which are not exist.........i know this issue is not a error ....but it make a confussion.......
waiting for ur reply
Fahim Babar Patel

Fahim Patel

unread,
Aug 31, 2012, 10:03:40 AM8/31/12
to rubyonra...@googlegroups.com
can one explain this issue?

Colin Law

unread,
Aug 31, 2012, 10:09:02 AM8/31/12
to rubyonra...@googlegroups.com
I think the most likely cause is that the keys on your keyboard are
sticking down causing all the repeated characters.

If you are referring to the fact that rails destroy attempts to delete
all the files that generate creates then that is just the way it is.
I don't think anyone really cares much how rails destroy works as it
is virtually never used. I don't think I have ever used it. If you
want to remove stuff you can just delete the files you don't want.

Colin

Jordon Bedwell

unread,
Aug 31, 2012, 10:17:03 AM8/31/12
to rubyonra...@googlegroups.com
It's not deleting anything.  Even though it claims it is it's just cruft in the terminal.  It's impossible to delete something that doesn't exist, well I should not say impossible as anything is possible but none-the-less the cruft is still outputted even if it does not delete anything.  Perhaps you should file a rails bug and ask them to adjust the message to imply "trying" instead of implying "doing". 

Fahim Patel

unread,
Sep 1, 2012, 7:12:23 AM9/1/12
to rubyonra...@googlegroups.com
i have given a code snippet .
u can watch it .
i think this the big issue

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/l8a8h9EFxqgJ.

Colin Law

unread,
Sep 1, 2012, 9:50:28 AM9/1/12
to rubyonra...@googlegroups.com
On 1 September 2012 12:12, Fahim Patel <paf...@gmail.com> wrote:
> i have given a code snippet .
> u can watch it .
> i think this the big issue

Why do you think it is a big issue?

Colin

Matt Jones

unread,
Sep 2, 2012, 11:59:42 AM9/2/12
to rubyonra...@googlegroups.com


On Friday, 17 August 2012 01:19:52 UTC-4, Fahim Patel wrote:

one more example
rails destroy controller testing
      remove  app/controllers/testing_controller.rb
      invoke  erb
      remove    app/views/testing
      invoke  rspec
      remove    spec/controllers/testing_controller_spec.rb
      invoke  helper
      remove    app/helpers/testing_helper.rb
      invoke    rspec
      remove      spec/helpers/testing_helper_spec.rb
      invoke  assets
      invoke    coffee
      remove      app/assets/javascripts/testing.js.coffee
      invoke    scss
      remove      app/assets/stylesheets/testing.css.scss

there is no testing controller prsent.....
this thing is happen with all directory structure....
scaffold also  do the same thing......

there should be any exception or error ??????????


No - the generator output is (slightly) confusing, but raising an exception in these cases would mean that you wouldn't be able to use 'destroy' to clean up after a generator if you'd manually removed any of the files it had created.

--Matt Jones
Reply all
Reply to author
Forward
0 new messages