This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
user ||= User.new #guest uesr | |
if user.is? 'developer' | |
can :manage, :all | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
products = Product.all :order => "id DESC" | |
i=1 | |
products.each{ |product| product.update_attribute('serial', i); i+=1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
songs = Song.find_by_sql("SELECT * FROM songs GROUP BY genre") | |
songs.each{ |song| Genre.create!(:name => song.genre) } # Genre jahez | |
songs.each do |song| | |
genre = Genre.find_by_name(song.genre) | |
Music.create!(:genre_id => genre.id, :song_name => song.name) #Music table jahez related with Genre | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<link rel="shortcut icon" href="images/favicon.ico" > | |
<title>YASSENY Furniture</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<link href="style/styles.css" rel="stylesheet" type="text/css" /> | |
<script type="text/javascript" src="js/swfobject/swfobject.js"></script> | |
<script type="text/javascript"> | |
var flashvars = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% content_for :header do -%> | |
Cases | |
<% end -%> | |
. | |
. | |
. | |
. | |
. | |
<% form_for (@kase), :html => { :multipart => true } do |f| %> | |
YOUR FORM STUFFS! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I'm trying to route my app with locale path_prefix. But unfortunately it doesnt work! | |
# I USE RAILS 2.3.8 | |
# routes.rb ---------- | |
ActionController::Routing::Routes.draw do |map| | |
map.with_options :path_prefix => '/:locale' do |m| | |
m.resources :users | |
m.root :controller => :dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ % ruby -v | |
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10] | |
~ % rvm list | |
rvm rubies | |
ruby-1.9.2-p0 [ x86_64 ] | |
~ % rvm use 1.9.2@rails2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ % ls -lahi $rvm_environments_path/ | |
total 48 | |
982510 drwxr-xr-x 8 amr staff 272B Aug 30 16:11 . | |
947759 drwxr-xr-x 24 amr staff 816B Jul 19 19:49 .. | |
10851993 -rw-r--r-- 1 amr staff 681B Aug 30 15:08 ruby-1.9.2-p0 | |
10856004 -rw-r--r-- 1 amr staff 720B Aug 30 15:14 [email protected] | |
10855967 -rw-r--r-- 1 amr staff 720B Aug 30 15:14 [email protected] | |
10851998 -rw-r--r-- 1 amr staff 735B Aug 30 15:08 ruby-1.9.2-p0@global | |
10856043 -rw-r--r-- 1 amr staff 735B Aug 30 15:15 ruby-1.9.2-p0@rails2 | |
10856079 -rw-r--r-- 1 amr staff 735B Aug 30 15:15 ruby-1.9.2-p0@rails3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Last login: Mon Aug 30 16:09:42 on ttys000 | |
~ % rvm --trace --default use 1.9.2@rails2 | |
--trace --default use 1.9.2@rails2 | |
rvm 1.0.1 by Wayne E. Seguin ([email protected]) [http://rvm.beginrescueend.com/] | |
+ [[ -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] | |
+ [[ ! -z '' ]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Last login: Mon Aug 30 16:30:07 on ttys000 | |
~ % ls -lahi $rvm_environments_path | |
total 48 | |
982510 drwxr-xr-x 8 amr staff 272B Aug 30 16:28 . | |
947759 drwxr-xr-x 24 amr staff 816B Jul 19 19:49 .. | |
11007334 lrwxr-xr-x 1 amr staff 49B Aug 30 16:17 default -> /Users/amr/.rvm/environments/ruby-1.9.2-p0@rails2 | |
10851993 -rw-r--r-- 1 amr staff 681B Aug 30 15:08 ruby-1.9.2-p0 | |
10851998 -rw-r--r-- 1 amr staff 735B Aug 30 15:08 ruby-1.9.2-p0@global | |
11011254 -rw-r--r-- 1 amr staff 735B Aug 30 16:28 ruby-1.9.2-p0@rails2 | |
11011255 -rw-r--r-- 1 amr staff 735B Aug 30 16:28 ruby-1.9.2-p0@rails3 |