Beginner Rails Queston : Controllers and Route -


I am very new to rail

Question 1 What is the path between the controller and the scene?

Say I have a controller named store_controller . I have no way in that controller, but I have a view called "list"

Then, I am able to call the local host: 3000 / store / list ... Why can I call without a list action in the controller?

What will happen if I add the list method to the controller below? If I call on the local host: 3000 / store / what will be the list? From the controller to the list method and then, to see? Or see the first and list method from the controller? Or will the inventory method never be called from the controller?

DEIF list logger at the end of the controller. Write "list" On the basis of my trial, the inventory method from the controller is never called. I'm not sure why I'm following the Azley Web Development with the book "Rail, Third Edition" and I'm stuck in "Task Sea: Cart Creation".

How to call the controller's method without using a Q3 assistant or without any template file for that method? Suppose I have a method called DoSomething in the controller

  def doSomething logger.Write 'd' end  

Do I see this method from below Can i

  & lt;% = link_to "do this" ,: verb => "Do something"% & gt;  

Based on my trial, it does not work

Edit: In fact, the viewer will send the controller You can call. Let's say that what we see on the screen is called the scene. If you click on the button, it will be the http-post and will call the controller. This is what I call the controller's method.

Q4. How to write logs in custom log file? If I use logger. Then all logs will be written in development.log. How can my custom log file be?

Q5 Is there any way to make Ruby and Rail like a scheduler? Should I use Ruby or Rail if I want to do something like a scheduler or back-end job? Such as pinging a feed in one second and if new changes then get the data and put it into the database

There may be a lot of questions to ask for: P ... but this is also a good base for the wiki. Question 1 Rail uses the convention - If you have a view called "list", then rail is a method which is adequate for this type of treatment such as list method exists. Of course, because there is no method, you will not have any logic, but the view will still be provided.

Q2. If you add the list method, then the rail will call it now. Then, the tracks are strong enough to understand that a list action map to see the list. If you want to make different views, you can use the controller's built-in "render" method.

Normally, you should not call the controller method from view. This is not just part of the MVC model. You can pass data in one view, you can use the assistant for any visual-specific methods. If you have a comprehensive custom argument, then you can start the code in your model and even create modules and classes in your / lib directory.

Q4 There are several logging plugins and extensions I have never used them, because I am always found to be more than the default.

Q5. Definitely this is a different question. Suggest to start a new one, but do a search as I know it has been addressed very long ago. There are many mechanisms that work with rail for scheduling.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -