Ruby On Rails اسئلة واجوبة المقابلات
Question: What is Filter and when is it called in Ruby on Rails?Answer:Filters are methods that are called either before/after a controller action is called. Say a user requests a controller action such as userdashboard/index In such a case a filter can be setup so that the UserDashboard/index page is only accessible to loggedin users by adding the following lines towards the beginning of the page: class UserDashboardController < ApplicationController In the code above the condition confirm_logged_in is checked before all actions, except login, logout & attempt_login. After filters (after_filter) are not used too much but they have the effect of executing some code after a particular action has completed. Think of them like triggers that get executed automatically just like a database trigger. |
احفظ للمراجعة
احفظ هذا العنصر في الإشارات المرجعية، او حدده كصعب، او ضعه في مجموعة مراجعة.
سجل الدخول لحفظ الإشارات المرجعية والاسئلة الصعبة ومجموعات المراجعة.
الاكثر فائدة حسب تقييم المستخدمين:
- What is Ruby On Rails?
- Why Ruby on Rails?
- Explain how (almost) everything is an object in Ruby.
- What are Gems and which are some of your favorites?
- How would you declare and use a constructor in Ruby?