application_helper:
def img_name_help(name)
name.gsub " ", "%20"
end
view:
<%= image_tag img_name_help "rails copy.png" %>
application_helper:
def img_name_help(name)
name.gsub " ", "%20"
end
view:
<%= image_tag img_name_help "rails copy.png" %>
#include <iostream> | |
#include <cmath> | |
#include <cstring> | |
using namespace std; | |
void printPrimes(int*start, int*finish) | |
{ | |
int length = *finish+1; | |
int upperBoundSqrt = (int) sqrt((double)*finish); // compute limit to marking off primes | |
bool primes[length]; |
#include <iostream> | |
#include <cmath> | |
#include <cstring> | |
using namespace std; | |
void printPrimes(int start, int finish) | |
{ | |
int length = finish+1; | |
int upperBoundSqrt = (int) sqrt((double)finish); // compute limit to marking off primes | |
bool primes[length]; |
class Role < ActiveRecord::Base | |
ROLES = [ :group_admin, :agency_admin ] | |
# - Relationships - | |
has_many :user_roles | |
has_many :users, :through => :user_roles | |
# - Class Methods - | |
class << self |
module ApplicationHelper | |
def build_navigation(ls=nil) | |
ls ||= links | |
res = "" | |
ls.each do |link| | |
if controller.controller_name == link[:url][:controller] && controller.action_name == link[:url][:action] | |
link[:html_options].merge!({ :class => "#{link[:html_options][:class]} current" } ) | |
end | |
res << "<li class=\"#{link[:html_options][:class]}\">" |
class Post < ActiveRecord::Base | |
has_many :tags, as: :taggable, through: :tag_joins | |
end | |
class Projects < ActiveRecord::Base | |
has_many :tags, as: :taggable, through: :tag_joins | |
end | |
class Tag < ActiveRecord::Base | |
has_many :taggables, through: :tag_joins |
class TagJoin < ActiveRecord::Migration | |
def change | |
create_table :taggables do |t| | |
t.string :name | |
t.integer :taggable_id | |
t.string :taggable_type | |
t.timestamps | |
end | |
end | |
end |
class Post < ActiveRecord::Base | |
has_many :tag_links, :as => :tags | |
# ... | |
end |
class Post < ActiveRecord::Base | |
has_many :tag_links | |
has_many :tags, :through => :tag_links | |
# ... | |
end |
require "bundler/capistrano" | |
set :application, "myapp" | |
#github stuff | |
set :repository, "git@github.com:fayimora/myapp.git" | |
set :scm, :git | |
set :scm_username, "xxx" | |
set :scm_passphrase, "xxx" |