My sample app with new look using rails


Hi friends,

Today i finished 5th chapter of Learning rails by example.

Today i used some css codes also. 🙂

i deployed my sample app into heroku site. here the link http://strong-sunrise-136.heroku.com/

site view

But finally got a problem, still i didn’t clear the problem, the problem is when i usineg ” rspec spec/” to check the codes, i got this result 😦 But all were working very well. i don’t know about this problem. first time i’m facing this problem,

[suresh@mercury final_third_part]$ !rs
rspec spec/
……F………

Failures:

1) UsersController GET ‘new’ should have the right title
Failure/Error: response.should have_selector(“title”,
expected following output to contain a <title>Sign up</title> tag:
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN” “http://www.w3.org/TR/REC-html40/loose.dtd“>
# ./spec/controllers/users_controller_spec.rb:13:in `block (3 levels) in <top (required)>’

Finished in 0.78985 seconds
16 examples, 1 failure

——————————————————————————————

Updated: Now i got the solution for this problem. I missed to add “render_views” into the “spec/controllers/users_controller_spec.rb ” file

😦  🙂

My Simple Application using Rails :)


Hi friends,

This is the simple and sample application to create using rails and heroku is here. This post mostly covers 3rd part of the “Learn Rails By Example” book.

$ rails new sample app -T

$ rails generate controller Pages home contact
$ gedit Gemfile

Edit the file and add the following,


source 'http://rubygems.org'

gem 'rails', '3.0.3'

gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'

group :development do
 gem 'rspec-rails', '2.3.0'
end

group :test do
 gem 'rspec', '2.3.0'
 gem 'webrat', '0.7.1'
 gem 'spork'
end

The Pages controller spec with a base title. spec/controllers/pages_controller_spec.rb


require 'spec_helper'
describe PagesController do
render_views

 describe "GET 'home'" do
  it "should be successful" do
     get 'home'
     response.should be_success
 end
 it "should have the right title" do
    get 'home'
    response.should have_selector("title",
        :content => "Ruby on Rails  Sample App | Home")
    end
 end
describe "GET 'contact'" do
  it "should be successful" do
    get 'contact'
    response.should be_success
  end
  it "should have the right title" do
   get 'contact'
   response.should have_selector("title",
       :content =>
   "Ruby on Rails Sample App | Contact")
   end
end
describe "GET 'about'" do
  it "should be successful" do
   get 'about'
   response.should be_success
  end
  it "should have the right title" do
   get 'about'
   response.should have_selector("title",
    :content =>
   "Ruby on Rails  Sample App | About")
   end
 end
end

The Pages controller with per-page titles.
app/controllers/pages_controller.rb


class PagesController < ApplicationController
def home
@title = "Home"
end
def contact
@title = "Contact"
end
def about
@title = "About"
end
end

The sample application site layout.
app/views/layouts/application.html.erb


<!DOCTYPE html>
<html>
<head>
<title>Ruby on Rails  Sample App | <%= @title %></title>
<%= csrf_meta_tag %>
</head>
<body>
<%= yield %>
</body>
</html>

The Home view with HTML structure removed.
app/views/pages/home.html.erb


<h1>Sample App</h1>
<p>
This is the home page for the
<a href="https://thasulinux.wordpress.com/">My Blog Home page</a>
sample application.
</p>

The Contact view with HTML structure removed.
app/views/pages/contact.html.erb


<h1>Sample App</h1>
<p>
This is the about page for
<a href="http://about.me/thasuresh/">Me</a>
sample application.
</p>

The About view with HTML structure removed.
app/views/pages/about.html.erb (This “about” page we ve to create manually)

<h1>About Me</h1>
<p>
Contact Ruby on Rails Tutorial about the sample app at the
<a href="https://thasulinux.wordpress.com/about/">feedback page</a>.
</p>

check out my sample project on-line at http://strong-sunrise-136.heroku.com/

In the url bar add this following “.com /”  “pages/home”  “pages/contact”  “pages/about”

(i.e)

http://strong-sunrise-136.heroku.com/pages/home

http://strong-sunrise-136.heroku.com/pages/contact

http://strong-sunrise-136.heroku.com/pages/about

update:

(Now, those is url were not in use, try http://strong-sunrise-136.heroku.com/)

Asciiquarium in Terminal (Fedora)


Hi friends,

If you want fun with terminal, follow the following instructions. 🙂 This is the project called ASCIIquarium. To install this we have to install some ‘prerequisites’ (Perl Module)

Install prerequisites:

$ sudo yum install perl-Curses perl-Extutils-MakeMaker
$ wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
$ tar xzvf Term-Animation-2.4.tar.gz
$ cd Term-Animation-2.4
$ perl Makefile.PL && make
$ sudo make install

Download Asciiquarium:

Now we are going to download the ‘asciiquarium’

$ wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
$ tar xzvf asciiquarium.tar.gz
$ cd asciiquarium_1.0
$ chmod +x asciiquarium
$ sudo mv asciiquarium /usr/local/bin/
$ asciiquarium

This slideshow requires JavaScript.

😛 😀 😉  That’s All !!! 

Enjoy 🙂

Note: If you want install this in your Ubuntu machine see here

Install Avant Window Navigator(AWN) in Fedora 14 and Ubuntu


Hi friends,

Avant Window Navigator(AWN) is a dock-like navigation bar for the Linux desktop that positions itself at the bottom of the screen. It can be used to keep track of open windows and behaves like a normal window list.

Installing Avant Window Navigator(AWN) in Fedora 14:
Type these as root user.

To install Avant Window Navigator(AWN),

$ yum install avant-window-navigator

To install the necessary applets for AWN,

$ yum install awn-extras-applets

=============================
Installing Avant Window Navigator(AWN) in Ubuntu:
$ sudo apt-get install avant-window-navigator
In ubuntu no need to install “Applets” packages. The “Applets” were already installed as Default. That’s ubuntu 😉 😛
AWN Over all view

Short view 🙂

Procedure for installing a OS inside Virtual Box


Hi friends,

In my Fedora machine i have Vm Virtual Box. me already installed ubuntu 10.10 inside of V Box. in our Office very weekend we have spl Admin class for us.

So, i installed a REDHAT 5. In side of VBox i separately installed REDHAT 3 times. Among the 3, one was server and other 2 were client.

The simple procedure for installing OS inside Virtual Box:


This slideshow requires JavaScript.

 

That’s All !!! 🙂