ruby-on-rails-3

Move RefineryCMS from Local to Production

匆匆过客 提交于 2020-01-15 05:15:13
问题 We decided to try using RefineryCMS for our current project and have run into some issues. We began the project in a local development environment. The deadline is very quickly approaching. At first, we tried to move the project into production using a DreamHost server. There were issues with the images (Refinery uses Dragonfly), where our database dump wasn't brining any images over (or thumbnails). We have exhausted our resources and still can't find a solution to our problem. I've done

Devise support for multiple concurrent sessions

余生长醉 提交于 2020-01-15 03:53:05
问题 I'm using Rails 3.2.11 with Devise 2.2.3 for a subscription service application. I inherited the app from another developer who is no longer available. I am new to Rails and Devise. I want to allow a single user (email) to have more than one session to the same app, running concurrently. The sessions may all have the same IP address or different IP addresses, though probably different devices -- desktop, laptop, table, smart phone. I want to treat each session independently, so the user can

Uninitialized constant using Twitter ruby gem

邮差的信 提交于 2020-01-15 03:00:26
问题 In my Rails 3 app I am attempting to display the tweets of users who have stored their twitter handle in my app as @profile.twitter . For each of those users I want to search their tweets with a specific hashtag. I'd like to perform the search in an action in my ProfilesController and load the tweets in a tabbed container. I took a crack at the controller action but am getting uninitialized constant ProfilesController::Twitter . Can anyone help explain why? This is my first crack at fetching

Remove HTTPS from Devise confirmation link when using Rack::SSLEnforcer

六眼飞鱼酱① 提交于 2020-01-15 01:55:27
问题 I'm using Devise and Rack::SSLEnforcer in a Rails app. When users receive their confirmation email, it looks something like: http://mysite.com:443/users/confirmation?confirmation_token=123456789xxx The link is auto-generated by Devise's confirmation_url method. This link shouldn't have the port 443 attached to it. In theory, I don't need the link to be to the https address, but it's fine if it is. At minimum, it should be https at the front, not port 443 at the end. Any ideas? 回答1: I solved

Disable Cookies in Rails 3.x app

帅比萌擦擦* 提交于 2020-01-15 01:24:13
问题 Is there a way to disable all cookies for a Rails app? Or preferably on a controller by controller basis? My problem is regarding access of a Rails JSON api by an Adobe Lightroom plugin. Apparently the presence of any cookie data in the response from the server causes an error in Lightroom. 回答1: In the controller you want to avoid cookies, add this: after_filter :skip_set_cookies_header def skip_set_cookies_header request.session_options = {} end If you have a set of api controllers, set this

How to auto-load data in the test database before to test my application?

删除回忆录丶 提交于 2020-01-14 22:48:51
问题 I am using Ruby on Rails 3.0.9 and RSpec 2. I would like to auto-load seed data in the test database before I tesst my application. That is, at the testing start up time (when I run tests) I would like to "auto-populate"\"auto-boot" the test database . How can I populate the database with seed data? P.S. : As I read around, (maybe) I should populate the test database by adding some code to the /spec/spec_helper.rb file... but what code and how? In my task/custom.rake file I have: namespace

has_many conditions or proc on foreign key

耗尽温柔 提交于 2020-01-14 18:13:51
问题 I have a has_many association between two models using a date as both the foreign and primary key for each model. It works perfectly one way but not the other. Works has_one :quiz_log, :primary_key => :start_at, :foreign_key => :start_at Doesn't work has_many :event_logs, :primary_key => :start_at, :foreign_key => :start_at The reason being (i think) because the start_at on QuizLog is a date and the start_at on EventLog is a datetime . So it returns nil trying to match the exact datetime on a

has_many conditions or proc on foreign key

眉间皱痕 提交于 2020-01-14 18:08:43
问题 I have a has_many association between two models using a date as both the foreign and primary key for each model. It works perfectly one way but not the other. Works has_one :quiz_log, :primary_key => :start_at, :foreign_key => :start_at Doesn't work has_many :event_logs, :primary_key => :start_at, :foreign_key => :start_at The reason being (i think) because the start_at on QuizLog is a date and the start_at on EventLog is a datetime . So it returns nil trying to match the exact datetime on a

Rails 3.2.2 mysql2 adapter Error

让人想犯罪 __ 提交于 2020-01-14 14:27:06
问题 I've been having trouble getting the mysql2 adapter working with the latest version of rails. I Just generated a new project. Added the following to my gemfile: gem 'mysql2', '< 0.3.7' then of course ran: bundle install I also modified my database.yml file: development: adapter: mysql2 encoding: utf8 database: blog_development username: root password: ********* socket: /tmp/mysql.sock test: adapter: mysql2 encoding: utf8 database: blog_test username: root password: ******** socket: /tmp/mysql

Action that refreshes the current page

允我心安 提交于 2020-01-14 14:02:27
问题 I want to create an action in a Rails controller that does something in the db and then just refreshes the current page. Example: Controller: A Views: A, B. controller A is the following: def action1 somethingToTheDB end view A is the following: -html- -body--link to action 1--/body- -/html- view B is the following -html- -body--link to action 1--/body- -/html- If I come to action 1 from view A I want to refresh view A, if I come from view 2 I want to refresh view 2. Is that possible without