AngularJS with Rails

1) Check the following URL for installation

http://blog.ricodigo.com/blog/2012/10/14/announcing-the-release-of-angularjs-scaffold/

2) for basics and for advance coding refer the following URL

http://angularjs.org/

3) for Installing/coding jasmine

1) https://github.com/pivotal/jasmine/wiki/A-Ruby-project-%28with-or-without-Rails%29
2) http://railscasts.com/episodes/261-testing-javascript-with-jasmine

 

www.klairvoyant.in

Posted in javascript, rails, ROR, ruby on rails, web development | Tagged , , , , , , , | 1 Comment

spree tools and tutorials

1) deface

http://guides.spreecommerce.com/view_customization.html
http://deface.heroku.com/
https://github.com/spree/deface
http://blog.endpoint.com/2010/01/rails-ecommerce-spree-hooks-tutorial.html

2)Theams

1) https://github.com/spree/spree_fancy
https://github.com/search?langOverride=&p=5&q=spree+theme&repo=&start_value=1&type=Repositories

3) Gem

http://guides.rubygems.org/specification-reference/#licenses=http://docs.rubygems.org/read/chapter/20

www.klairvoyant.in

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | 1 Comment

How to join and configure IRC in pidgin

you want the to collect 1)IRC Server name 2) channel name 3) and port number

example :-

IRC Server: morgan.freenode.net
Port: 6667
Channel: #spree
A) Joining in a IRC channel

1) used web-based client to access the Freenode IRC network ( http://webchat.freenode.net/?randomnick=1&channels=spree&prompt=1&uio=d )

2) connected using a nickname and channel name

3) register your name and password by typeing the following command and following the email instructions

/msg nickserv register [PASSWORD] [youremail]

 

B) configuring in pidgin
1)In pidgin on Accounts -> Manage click add

2) use protocol IRC, enter screen name, server, password etc..

3) go to menu and select buddies->join a chat

4) Select your IRC account from the drop down

5) enter channel, password information and click join
source

1) http://spreecommerce.com/blog/irc-101
2) http://thecyberian.wordpress.com/2008/05/09/irc-tutorial-how-to-set-up-pidgin-in-5-easy-steps/
3) http://www.irchelp.org/irchelp/new2irc.html

 

www.klairvoyant.in

Posted in chat, web development | Tagged , , | Leave a comment

what is rails templates ?

generators can be used inside an application, they can also be used to generate applications too, This kind of generator is referred as a “template”.

example

gem(“rspec-rails”, :group => “test”)
gem(“cucumber-rails”, :group => “test”)

if yes?(“Would you like to install Devise?”)
gem(“devise”)
generate(“devise:install”)
model_name = ask(“What would you like the user model to be called? [user]”)
model_name = “user” if model_name.blank?
generate(“devise”, model_name)
end
here we specify

1) we want to add rspec-rails and cucumber-rails gem
2) asking whether or not like to install Devise. if answer is yes devise gem is added and then runs the devise:install generator
3) asking more input from user and run devise generator

 

if the file called template.rb. we can use it as follows

rails new myapp -m template.rb

 

For Rails Template Tutorials

http://guides.rubyonrails.org/generators.html
http://railsapps.github.com/rails-application-templates.html
http://blog.madebydna.com/all/code/2010/10/11/cooking-up-a-custom-rails3-template.html
http://quickleft.com/blog/rails-application-templates
http://m.onkey.org/rails-templates
For Rails Templates

http://railswizard.org/
http://appscrolls.org/
http://railsapps.github.com/rails-composer/
http://drone.bz/new

 

www.klairvoyant.in

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , | Leave a comment

How to create a Gem file

1) bundle gem gemwork1

(My IDE has option for “Gem Application” and given the name “gemwork1” as the application name)

2) in ‘lib/gemwork1.rb’ add the functionality code

example

add the following code to already existing module “Gemwork1”. here we adding form validation for email field

def validates_email_address_of attr_name

email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
self.validates_format_of attr_name,
:with => email_regex,
:message => “is not a valid email address”
end
To extend it with ActiveRecord::Base class add this too

require “gemwork1”
class ActiveRecord::Base
extend Gemwork1
end

where “gemwork1” is file name and “Gemwork1” is module name

3) build the gem:- gem build gemwork1.gemspec or gem build
4) to install it into your system:- rake install
5) to check the working

create a new rails project and add the following in your Gemfile:
gem ‘gemwork1’

Run bundle, generate a User scaffold with an email:string attribute and migrate the database. In your User model add a validation for a given email string

validates_email_address_of :email

Now start the server and try to create a new user with an email address like “foo”. Rails should output an validation error.

6) to publis the gem in RubyGems

want a account in https://rubygems.org/. during the push command it will ask email and password for sign in
gem push gemwork1-0.0.1.gem

references

1) http://blog.galk.me/post/7443618295/getting-started-with-gems-how-to-create-a-gem-for
2) http://railscasts.com/episodes/245-new-gem-with-bundler

 

www.klairvoyant.in

 

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , | Leave a comment

Raphaël ( JavaScript library ) in rails

1) Download raphael.js ( downloaded file not worked with me. so fetched it from source code of sample works)
2) added it to the folder app/assets/javascripts
3) create a javascript file for our Raphaël code
example

$(document).ready(function(){

var paper = Raphael(“sample-1”, 200, 100);
var rectPath = paper.path(“M10,10L10,90L90,90L90,10Z”);
var curvePath = paper.path(“M110,10s55,25 40,80Z”);

rectPath.attr({fill:”green”});
curvePath.attr({fill:”blue”});
})

here “sample-1″ is dom ID presented in our view file as

<div id=”sample-1”> </div>

sources

1) http://raphaeljs.com/
2) http://www.html5rocks.com/en/tutorials/raphael/intro/
3) http://cancerbero.mbarreneche.com/raphaeltut/#sec-getting-started

for more about path

4) http://www.w3.org/TR/SVG/paths.html#PathData

for Text with custom fonts

5) https://github.com/sorccu/cufon/wiki/about
6) http://cufon.shoqolate.com/generate/

for free javascript font

7) http://www.cufonfonts.com/

www.klairvoyant.in 

Posted in javascript, rails, ruby on rails, web development | Tagged , , , | 6 Comments

spree with Heroku and Amazon S3

A) spree installation 

1) add in gem file and bundle install
gem ‘spree’
gem ‘spree_auth_devise’
gem ‘spree_gateway’, :git => ‘git://github.com/spree/spree_gateway.git’, :branch => “1-3-stable”

2) rails g spree:install
3) bundle exec rake spree_auth:install:migrations
4) bundle exec rake db:migrate
5)change the following line in config/initializers/spree.rb
Spree.user_class = “Spree::LegacyUser”  to    Spree.user_class = “Spree::User”
6) bundle exec rake spree_auth:admin:create
7) to change logo rename your logo to “spree_50.png” and place at
/app/assets/images/admin/bg/spree_50.png
8) added extensions the extension spree_self_delivery

B) Deployment on Heroku and Amazon S3

1) underneath the other config.assets lines inside config/application.rb add
config.assets.initialize_on_precompile = false

2) To configure Spree to upload images to S3, put these lines into config/initializers/spree.rb:

Spree.config do |config|
config.use_s3 = true
config.s3_bucket = ‘<bucket>’
config.s3_access_key = “<key>”
config.s3_secret = “<secret>”
end

3) in config/initializers/spree.rb:

Paperclip.interpolates(:s3_eu_url) do |attachment, style|
“#{attachment.s3_protocol}://#{Spree::Config[:s3_host_alias]}/#{attachment.bucket_name}/#{attachment.path(style).gsub(%r{^/}, “”)}”
end

4) git push heroku master
5) heroku run rake db:migrate
6) heroku run rake spree_auth:admin:create
7) heroku run rake db:seed
8) add addon sendGrid in heroku
Refer http://guides.spreecommerce.com/deploying_on_heroku.html

problem 1 :- Countries and States list not available in Spree

solution:- rake db:seed

www.klairvoyant.in
http://orchids.klairvoyant.com

Posted in rails, ROR, ruby on rails, web development | Tagged , , , , , , , , , | 1 Comment

Phusion Passenger,capisantro:- rails Deployment

gem install passenger

 

reference

http://www.modrails.com/documentation/Users%20guide%20Apache.html
http://www.aaginskiy.com/technology/2011/02/deploying-rails-3-apps-with-capistrano/

Posted in ruby on rails | Leave a comment

Error gem not installed

solution

gem list -d rake
from the output get the installation path and execute the command as follows
gem uninstall –install-dir /home/john/.rvm/gems/ruby-1.9.3-p362@global rake -v 10.0.3

here rake is gem name and 10.0.3 version of the gem

source
http://railsforum.com/viewtopic.php?id=28313

 

www.klairvoyant.in

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | Leave a comment

Error:- ActionView::Template::Errror (application.css isn’t precompiled)

Rails assumes that you have your files precompiled in the production environment.

if want live compiling (compile at runtime) set as the following

in the file config/environments/production.rb

config.assets.compile = true
for better performance in production want to set config.assets.compile to false in production.rb

You can precompile with this rake task:

bundle exec rake assets:precompile

 

www.klairvoyant.in

Posted in rails, ROR, ruby on rails, web development | Tagged , , , | Leave a comment