Post-install message from httparty:


When you HTTParty, you must party hard!
Post-install message from cucumber:

(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)

Thank you for installing cucumber-1.1.9.
Please be sure to read http://wiki.github.com/cucumber/cucumber/upgrading
for important information about this release. Happy cuking!

(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
Post-install message from paperclip:
##################################################
# NOTE FOR UPGRADING FROM PRE-3.0 VERSION #
##################################################

Paperclip 3.0 introduces a non-backward compatible change in your attachment
path. This will help to prevent attachment name clashes when you have
multiple attachments with the same name. If you didn’t alter your
attachment’s path and are using Paperclip’s default, you’ll have to add
`:path` and `:url` to your `has_attached_file` definition. For example:

has_attached_file :avatar,
:path => “:rails_root/public/system/:attachment/:id/:style/:filename”,
:url => “/system/:attachment/:id/:style/:filename”
Post-install message from watir-webdriver:
Please note that watir-webdriver 0.5.0 brings some backwards incompatible changes:

* Watir::Select#selected_options no longer returns Array<String>, but Array<Watir::Option>
[ https://github.com/watir/watir-webdriver/issues/21 ]
* Finding elements by :class now matches partial class attributes.
[ https://github.com/watir/watir-webdriver/issues/36 ]

Additionally, watir-webdriver 0.5.1 removes the following deprecated methods:

* element_by_xpath : replaced by .element(:xpath, ‘…’)
* elements_by_xpath : replaced by .elements(:xpath, ‘…’)

And deprecates the following methods:

* Browser#clear_cookies – replaced by Browser#cookies API
[ https://github.com/watir/watir-webdriver/issues/24 ]

heroku db:push


Make sure all gems are install on your system.
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install sqlite3-ruby

gem install heroku taps sequel

sudo gem install tabs

sudo heroku db:push

OR

sudo heroku db:push –config herokuServerName

If still problem. Use below command

heroku db:pull postgres://root:@localhost/db_name

Else

sudo heroku db:pull --confirm herokuDomanName postgres://userName:@localhost/Locadatabase
 root will be database user name and db_name is database name
Good Luck.........!!

Export data to CSV and Excel in your Rails


A common requirement from customers is the ability to export tabular data to a CSV file that can be imported into Excel. Ruby on Rails uses the standard ruby CSV library to import test fixtures that are in CSV format.

Below are the steps we need to follow.

1. require the CSV library to controller, Where we need to write import code

require 'csv'

2. Emport code in controller

def export_to_csv       
    @users = User.find(:all)
    csv_string = CSV.generate do |csv|
         csv << ["Id", "Name", "Email","Role"]
         @users.each do |user|
           csv << [user.id, user.name, user.name, user.role]
         end
    end         
  
   send_data csv_string,
   :type => 'text/csv; charset=iso-8859-1; header=present',
   :disposition => "attachment; filename=users.csv" 
end 


@users = User.find(:all)
Fetching all user details and assigned on @users
csv_string = CSV.generate do |csv|
Using CSV class generate method to create csv file
csv << ["Id", "Name", "Email","Role"] 
Creating header of CSV file

@users.each do |user|
  csv << [user.id, user.name, user.name, user.role] 
end 
Retrieving each rows and assigning on csv_string variable.


send_data csv_string,
:type => 'text/csv; charset=iso-8859-1; header=present',
:disposition => "attachment; 
filename=users.csv" 
sending data to browser. 

Enjoy........... 

Heroku: Getting Started as a Collaborator


One of my recent client project, Client had added me as a collaborator on this working heroku. I was bit confused how will i access/pull/push my code to server. After long research and some mistakes, Finally i am able to perform all relevant operation as developer. Below are few steps we should to follow.

1. Move to your working directory.

$cd appDir

2.Check, Are you already sign-in to heroku server?

$ heroku keys

Will display all keys if you added to heroku for other account. Else you see prompt

$ heroku keys
Enter your Heroku credentials.
Email:

Here you need to Login using your collaborator email id and password. Once you get login, Heroku will add your ssh key. if not then you should to run manually

$ heroku keys:add

That’s it…..

Now you able to pull/push your code to server(Be sure you pushing your code as master OR collaborator).

Few more heroku command, May it helps some times.

1. Login to heroku.

$ heroku login

2. Logout from current session.

$ heroku logout

3.Remove unnecessary ssh key

$ heroku keys:remove KEYNAME

4. Wanted to add other collaborator(developer)

$ herku sharing:add test@gmail.com

“test@gmail.com” is email id of collaborator

5. List app info

$ heroku info

6. Remove collaborator

$ herku sharing:remove test@gmail.com

7. Push code

$ git push heroku 

 

fatal: ‘heroku’ does not appear to be a git repository


I was facing same issues, When i cloned a client project and he had already created heroku server. Even he collaborated me to his account.

Below googled solution worked for me.

git remote add heroku git@heroku.com:appname.git

Where appname is the name of your app.

After that

git push heroku master

(assuming you want to push the master branch)