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
# POST /jobs | |
# POST /jobs.xml | |
def create | |
#ADD THIS LINE | |
@catergory= Catergory.find(params[:catergory_id])#This is the new line added | |
#It stores the value retrieved from the select box which displays the available categories to be added | |
#END ADD | |
@job = Catergory.jobs.build(params[:job]) |
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 Job < ActiveRecord::Base | |
belongs_to :catergory | |
# UPLOAD a file for the logo | |
def upload | |
uploaded_io = params[:job][:logo] | |
File.open(Rails.root.join('public', 'images', uploaded_io.original_filename), 'w') do |file| | |
file.write(uploaded_io.read) | |
end | |
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
ActiveRecord::RecordNotFound in JobsController#create | |
Couldn't find Catergory without an ID | |
RAILS_ROOT: /Users/safarista/Sites/jobs | |
Application Trace | Framework Trace | Full Trace | |
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1597:in `find_from_ids' | |
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:619:in `find' | |
/Users/safarista/Sites/jobs/app/controllers/jobs_controller.rb:50:in `create' |
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
Showing /Users/safarista/Sites/Rails3/ilinkoln_blog/app/views/layouts/application.html.erb where line #85 raised: | |
incompatible character encodings: ASCII-8BIT and UTF-8 | |
Extracted source (around line #85): | |
82: </li> | |
83: <li> | |
84: <%= link_to image_tag("twitter.png"), "http://www.twitter.com/ilinkoln/" %> | |
85: </li> |
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
Gems included by the bundle: | |
* abstract (1.0.0) | |
* actionmailer (3.0.3) | |
* actionpack (3.0.3) | |
* activemodel (3.0.3) | |
* activerecord (3.0.3) | |
* activeresource (3.0.3) | |
* activesupport (3.0.3) | |
* arel (2.0.6) | |
* builder (2.1.2) |
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
<p id="notice"><%= notice %></p> | |
<article class=""> | |
<h1><%= @post.title %></h1> | |
<h2> | |
<%= @post.created_at.strftime('%b %d, %Y') %> • By: | |
<%= link_to "#{@post.user.name}", @user %> | |
• Category: |
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
########User Models######### | |
class User < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :confirmable, :lockable and :timeoutable | |
devise :database_authenticatable, :registerable, | |
:recoverable, :rememberable, :trackable, :validatable; :omniauthable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :email, :password, :password_confirmation, :remember_me |
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
module Roman | |
ARABIC = {'I': 1, 'V': 5, 'X': 10, 'L': 50, | |
'C': 100, 'D': 500, 'M': 1000 } | |
def self.const_missing(name) | |
digits = [*name.to_s.upcase.chars].reverse.map{|r| ARABIC[r] or super} | |
digits.map.with_index {|d,i| digits[i.zero? ? i : i-1] > d ? -d : d}.reduce(:+) | |
end | |
end | |
Roman::XLVII #=> 47 |
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
@rhiaro @iLinkoln You should relish the challenge then :p But I know full well you start with the design and work backwards. That's right, BACKWARDS | |
“@rhiaro: @iLinkoln No, we should develop websites with an eye to cater for everyone. http://t.co/wQ4lRVd http://t.co/H6ma0aw”> take sides |
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 ApplicationController < ActionController::Base | |
protect_from_forgery | |
def current_ability | |
@current_ability ||= Ability.new(current_member) | |
end | |
rescue_from CanCan::AccessDenied do |exception| | |
flash[:alert] = "Access Denied." | |
redirect_to root_url |
OlderNewer