This file contains hidden or 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 || User.new # for guest | |
guest | |
administrator if user.is_admin? | |
end | |
def guest |
This file contains hidden or 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 /offers | |
# POST /offers.json | |
def create | |
@offer = Offer.new(offer_params) | |
@offer.offer_timestamp = Time.zone.now | |
@offer.user = current_user | |
respond_to do |format| | |
if @offer.save | |
format.html { redirect_to [@offer.product, @offer], notice: 'Offer was successfully created.' } |
This file contains hidden or 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
D:\wamp\www\austin\austinparker_it>gem uninstall zentest | |
Invalid gemspec in [D:/Programs/Ruby/Ruby193_362/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.0.gemspec]: Illformed requirement ["< 2.1, >= 1.8"] | |
Invalid gemspec in [D:/Programs/Ruby/Ruby193_362/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.0.gemspec]: Illformed requirement ["< 2.1, >= 1.8"] | |
INFO: gem "zentest" is not installed |
This file contains hidden or 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
require 'spec_helper' | |
describe "Pages" do | |
describe "Testing locale" do | |
describe "GET /en" do | |
it "should have english text" do | |
visit '/en' | |
page.should have_content('Hello') | |
end | |
end |
This file contains hidden or 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
require 'spec_helper' | |
describe 'Users' do | |
describe 'Login' do | |
it 'should login the user and show logout link' do | |
user = FactoryGirl.create(:user) | |
visit new_user_session_path | |
fill_in 'Email', with: user.email | |
fill_in 'Password', with: user.password | |
click_button 'Sign in' |
This file contains hidden or 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
FactoryGirl.define do | |
factory :tech_spec_name do | |
sequence(:name) { |n| "#{ Faker::Lorem.word } #{ n }"} | |
end | |
factory :boat do | |
name { Faker::Name.first_name } | |
end | |
factory :tech_spec do |
This file contains hidden or 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
FactoryGirl.define do | |
factory :tech_spec_name do | |
sequence(:name) { |n| "#{ Faker::Lorem.word } #{ n }"} | |
end | |
factory :boat do | |
name { Faker::Name.first_name } | |
end | |
factory :tech_spec do |
This file contains hidden or 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 TechSpec < ActiveRecord::Base | |
validates :boat_id, presence: true | |
validates :tech_spec_name_id, presence: true, uniqueness: { scope: :boat_id } | |
belongs_to :boat | |
belongs_to :tech_spec_name | |
acts_as_list scope: :boat | |
def as_json(options = {}) |
This file contains hidden or 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 AdminController < ApplicationController | |
layout 'admin' | |
end |
This file contains hidden or 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 TripsController < ExtjsController | |
def viewer | |
if true # Ok qua non c'era questa if ma non mi va di andare a prendere in cima quella giusta | |
# ... Lunghissima e inutile configurazione della query... | |
@trips = Trip.joins(table_join_to_cache) | |
.where(trips_find_condition_values) | |
.uniq.order('begin_date ASC, title ASC') | |
.page(params[:page]) |
OlderNewer