Greetings!
Today i learnt a bit on HTML, CSS and then proceeded with Chapter 10 of Learn Rails by Example
In HTML i worked with image tag <img> from w3schools
I learnt the following things in <img> tag
- <img> tag is used to insert an image into an HTML document
- There is no closing tag for it.
- Contains common attributes such as src, alt, width, height, border
- src – specifies the path of the image
- alt – specifies the alternate text for the image
- width, height – specifies the dimension for the image
- border – sets the border for an image
To insert an image into an HTML document, i just followed the code to display the image in browser
<html> <body> <img border="0" src="/home/rajee/animal.jpg" alt="Deer" width="100" height="100" /> </body> </html>
Then i switched to learn CSS from CSS CookBook by Christopher Schmitt available in our library
The book covers nearly 500 pages
I set a goal to complete 5 pages per day.
Though its a too too small small goal, i want to follow it everday with good understanding of my workarounds. And this is my real goal 🙂 🙂
From yesterday i started to learn CSS
So, today i completed 10 pages from the book.
I came across the following two selectors in CSS cookbook
- Type Selectors
- Class Selectors
Type Selectors
It represents the HTML tags or the elements
Example
h1 { font-size:100%; }
body { background-color : red; }
Class Selectors:
It is used to apply the same CSS rule many times to different elements.
Example
<html> <head> <title>CSS Cookbook</title> <style type="text/css"> .warning { font-weight:bold; } </style> </head> <body> <p>A para <a href="http://csscookbook.com">link</a>. <p>Second para illustrating the <em>class selector</em> example</p> </body> </html>
Then i started to watch and work with the rails screencast
Previously, i stopped in quarter portion of Chapter 10 ( i.e., i just worked with first half an hour of the tutorial )
I resumed from where i left and watched next one hour lesson
In my workaround i learnt how to implement a bit of security model while updating users
The first step is to protect pages from unauthorised access by requiring signing in ( ie., if someone wants to access edit page, he/she should be redirected to sign-in page )
It is done using before_filter
Writing test cases in users_controller_spec.rb
describe "authentication of edit/update actions" do before(:each) do @user = Factory(:user) end it "should deny access to 'edit'" do get :edit, :id => @user response.should redirect_to(signin_path) end it "should deny access to 'update'" do put :update, :id => @user, :user => { } response.should redirect_to(signin_path) end end
Adding before_filter in users_controller.rb
before_filter :authenticate, :only => [:edit, :update] def authenticate redirect_to signin_path unless signed_in? end
By 3.45p.m., we gathered for a SCRUM Meet and i told like as i exlpored on HTML,CSS,Chapter 10 of Learn Rails by Example
Will be continue to work with these technologies tomorrow 🙂