-1
I scaffed the Rails... okay. Now I’m using Gem paranoia to give a software delete, but that’s it, how do I give the command for example this, in a post mine? Which way...
-1
I scaffed the Rails... okay. Now I’m using Gem paranoia to give a software delete, but that’s it, how do I give the command for example this, in a post mine? Which way...
1
To manipulate a Linux database through the terminal you just need to:
mysql -u root -p
: "-u" to inform the user, which in this case is "root" and "-p" for Linux to display the password field, so you type the correct password and access the Mysql shell on the Linux terminal;
DELETE FROM
minha_tabela
WHERE field = "value";
0
I don’t quite understand your question. But I will post some ways to work with records.
Enter your application folder with the terminal and type: Rails console
Change the "Post" to your model.
Post.delete_all #deleta todos os registros do model Post
Finding and removing records by id.
post = Post.find_by_id(5) # Encontra post de id 5 e armazena na variavel post
post.destroy #remove post
find_by can be used for other fields. Ex "title"
post = Post.find_by_title("Curso de Artes")
Vlw!
Browser other questions tagged ruby-on-rails ruby
You are not signed in. Login or sign up in order to post.