Skip to content

Instantly share code, notes, and snippets.

before_create :generate_url
def generate_url
self.invitation_url = "http://www.dreamstill.com/?id=" + self.sender_id.to_s
end
module SignedUsersHelper
def create_invitation(user)
@invitation_url = "http://dreamstill.com/?id=" + rand(10000000000).to_s
user.invitation.create(:invitation_url => @invitation_url)
end
end
>> rand(20..30)
TypeError: can't convert Range into Integer
from (irb):6:in `rand'
from (irb):6
from :0
2011-04-28T20:30:48+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2011-04-28T20:30:48+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2011-04-28T20:30:48+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2011-04-28T20:30:48+00:00 app[web.1]: WHERE a.attrelid = '"signed_users"'::regclass
2011-04-28T20:30:48+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2011-04-28T20:30:48+00:00 app[web.1]: ORDER BY a.attnum
2011-04-28T20:30:48+00:00 app[web.1]: ):
2011-04-28T20:30:48+00:00 app[web.1]: app/controllers/signed_users_controller.rb:3:in `new'
2011-04-28T20:30:48+00:00 app[web.1]: app/controllers/signed_users_controller.rb:3:in `new'
2011-04-28T20:30:48+00:00 app[web.1]:
Vimeo: /^(http:\/\/)?(www\.)?vimeo\.com\/(\d+)/
SoundCloud: /^(http:\/\/)?(www\.)?soundcloud\.com\/(.*)/
VALID_URLS = [
/^(?:http:\/\/)?(?:www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_-]*)/,
/^(?:http:\/\/)?(?:www\.)?vimeo\.com\/(\d+)/,
/^(?:http:\/\/)?(?:www\.)?soundcloud\.com\/(\w+)/,
nil
]
validates :link, :uniqueness => true,
:format => { :with => Regexp.new(VALID_URLS.join('|')) }
$.ajax({type:"POST", url:("/showable_videos.js"), data:{[profile:profile_val, video:val]}});
showable_videos GET /showable_videos(.:format) {:action=>"index", :controller=>"showable_videos"}
POST /showable_videos(.:format) {:action=>"create", :controller=>"showable_videos"}
new_showable_video GET /showable_videos/new(.:format) {:action=>"new", :controller=>"showable_videos"}
edit_showable_video GET /showable_videos/:id/edit(.:format) {:action=>"edit", :controller=>"showable_videos"}
showable_video GET /showable_videos/:id(.:format) {:action=>"show", :controller=>"showable_videos"}
PUT /showable_videos/:id(.:format) {:action=>"update", :controller=>"showable_videos"}
DELETE /showable_videos/:id(.:format)
def build_table_aliases(from)
# for the targets
{}.tap do |aliases|
from.map(&:to_s).sort.map(&:to_sym).each_with_index do |plural, t_index|
begin
table = plural._as_class.table_name
rescue NameError => e
raise PolymorphicError, "Could not find a valid class for #{plural.inspect} (tried #{plural.to_s._classify}). If it's namespaced, be sure to specify it as :\"module/#{plural}\" instead."
end
begin
ActiveRecord::Associations::PolymorphicError in Videos#index
Showing /rubyprograms/dreamstill/app/views/videos/_video.html.erb where line #3 raised:
Could not find a valid class for :showable_objects_users (tried ShowableObjectsUser). If it's namespaced, be sure to specify it as :"module/showable_objects_users" instead.