I made a scaffold in the rails ... OK. Now to using the paranoia gem to give a software delete, but there is that ta, how do I give the command for example of this, in a post of mine? Which way ...
I made a scaffold in the rails ... OK. Now to using the paranoia gem to give a software delete, but there is that ta, how do I give the command for example of this, in a post of mine? Which way ...
To manipulate a database in Linux through the terminal you just need:
mysql -u root -p
: "-u" to inform the user, which in this case is "root" and "-p" for Linux to display the password field, then you type the correct password and access the MySQL shell on the Linux terminal;
DELETE FROM% WITH_CORE% WHERE field="value";
I did not quite understand your question. But I'll post some ways to work with records.
Enter your application folder with the terminal and type: rails console
Change the "Post" for 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!