小编Ole*_*nyk的帖子

如何跟踪推文按钮点击?

我想通过Google Analytics跟踪推文按钮点击次数,但推文按钮是一个包含来自其他域名内容的iframe.是否有一些技巧可以为推文按钮点击添加回调?

javascript twitter iframe google-analytics same-origin-policy

20
推荐指数
1
解决办法
6815
查看次数

使用Ruby文件设置Content-Type创建的文件?

我正在使用动态File.open创建.csv文件.

但我需要做的是将Content-Type文件设置为binary/octet-stream以便浏览器自动下载它而不是仅在浏览器中显示它的内容.

文件本身在本地创建,然后上载到Amazon S3.

ruby file-io content-type file amazon-s3

5
推荐指数
1
解决办法
6376
查看次数

Rails 3.1.3按日期自定义路由

如何为这条路线制作路径助手?

resources :news

match 'news/:year/:month/:day' => 'news#show',
    :constraints => { :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/ },
    :as => 'newsdate'
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法,但它不起作用:

link_to news.created_at.strftime '%d.%m.%Y ', newsdate_path(:year => '2011', :month => '11', :day => '11')
Run Code Online (Sandbox Code Playgroud)

我通过GET http:// localhost:3000/news获得此行的应用程序错误:

ArgumentError in News#index

    Showing /home/foxweb/work/dev/app/views/news/index.html.slim where line #6 raised:

    wrong number of arguments (2 for 1)
Run Code Online (Sandbox Code Playgroud)

如何正确的方式?

PS http:// localhost:3000/news/2011/11/11工作正常.

url ruby-on-rails ruby-on-rails-3

4
推荐指数
1
解决办法
194
查看次数

如何在rails中创建图像?(来自php中的imagecreate())

我需要从imagemagick/rmagick库创建一个图像,我该怎么做?就像在php中一样,用GD库完成.

 <?php 
      header ("Content-type: image/png"); 
      $handle = ImageCreate (130, 50) or die ("Cannot Create image"); 
      $bg_color = ImageColorAllocate ($handle, 255, 0, 0); 
      ImagePng ($handle); 
  ?> 
Run Code Online (Sandbox Code Playgroud)

在输入中,我给出了图像颜色,区域标签的图像坐标,这样的想法?

php ruby-on-rails rmagick

4
推荐指数
1
解决办法
2939
查看次数