What should my .htaccess file include in order to work in rails this is what I have now and I want to make sure its correct:
AddHandler fastcgi-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch...
I need some way of connecting to a pop mailbox (this is read-only - I'm not sending out any emails) and then parsing the messages in the mailbox.
Is there a plugin or library for this in Rails?
...
I've been running Ruby on Rails on FreeBSD. It takes 10-20 seconds just to load the environment. Is there anything that I can do to make it load faster, or is FreeBSD just not a good platform for Ruby on Rails?
...
I'm getting a ton of (what I would call) extraneous autocomplete information in Ruby Netbeans 6.5.1.
For example, if I type the name of a model object and then type a period (whether I'm in a controller or a view), it shows a dizzying dropdown list of thousands of methods, including several hundred different versions of the "new" method...
Assume this ruby code:
class User
def self.failed_login!(email)
user = User.find_by_email(email)
if user
user.failed_login_count = user.failed_login_count + 1
user.save
end
end
end
I want to write a test that tests that user.save is never called when an invalid email is given. E.g.:
it "should not incremen...
Hey.
Say I want to queue these JS calls, can that be done with the Rails helpers?
render :update do |page|
page.replace_html replace_html 'notice', flash[:notice]
page.visual_effect :blind_down, "notice", :duration => 0.5
page.visual_effect :blind_up, "notice", :duration => 0.5
end
Thanks.
...
How should one have several different controller' actions set a common instance variable for use in templates but after the action runs.
In other words, I want this to work in my application_controller.
class ApplicationController < ActionController::Base
after_filter :set_something_common
def set_something_common
# All contro...
Is it ok to instantiate an object in a View before passing it to a partial?
<%= render :partial => "trade_new", :locals => {:trade=>Trade.new("e", "b") } %>
Or is better to instantiate any objects in the Controller as instance variables:
@trade = Trade.new("e", "b")
and then pass the instance variable to a partial in the view like ...
Hello,
I'm using a Rails application and would like to send/receive text messages through my application. Two solutions I looked at is using SMS Gateway and using a cell phone paired with Bluetooth with my Mac and I have ultraSMS program running that sends SMSs through the phone. The second option is definitely a lot cheaper as SMS gate...
i have a table called images which consists of alot of images from property images to estate logos...i've written a ruby code to get all property images which works fine...the only problem i have is i want the images to display as a clickable slideshow instead of showing all the images at ones
...
I'm trying to make an autocomplete textfield for my Rails app, following the Agile Web Development with Rails, 3rd Ed example. But if I simply paste their demo code in:
<%= stylesheet_link_tag 'autocomplete' %>
<h1>Editing user</h1>
<% form_tag :action => 'update', :id => @user do %>
<%= error_messages_for 'user' %>
<p>Username<br...
In Rails 2.2.2
In my model I have this:
class Question < ActiveRecord::Base
set_table_name "t346128_question"
set_primary_key "question_id"
has_many :sections, :order => 'position, section_id', :dependent => :destroy
...
end
And in my controller, this:
def answer()
@question = Question.find(params[:id])
puts "question=#...
I have a very simple controller:
require 'net/ssh'
class MyController < ApplicationController
def foo
render :text => 'bar'
end
end
But when I request http://server:3000/my/foo I get:
MissingSourceFile in MyController#foo
no such file to load -- net/ssh
The gem is installed
> gem list net-ssh
*** LOCAL GEMS ***
...
I'm using the auto_complete plugin and have a simple autocomplete textfield by writing this in my controller:
class PrivateMessagesController < ApplicationController
auto_complete_for :role, :name
and this in my view:
<label for="recipient">To:</label>
<%= text_field_with_auto_complete :role, :name %>
I want to improve the au...
How do I place a link at the top of my page when the URL that it is pointing to is not determined until later down the page. In this example, I want to move Create and Edit Scenario links to the top of the page, but as you can see Edit Scenario depends on knowing the @scenario_id first.
<%= will_paginate @scens, :next_label => 'Older', ...
I have a some code that embeds a return_to URL into a redirect (like OpenID) that I want to test:
def test_uses_referrer_for_return_to
expected_return_to = 'http://test.com/foo'
@request.env['HTTP_REFERER'] = expected_return_to
get :fazbot
# @response.redirected_to looks like http://service.com?...&return_to=[URI-encoded ver...
I've create a view in MySQL which corresponds to some reports I'm generating (sums grouped by month, year with a roll up). The view has 3 columns (year, month, total). View/Table name is "report_monthly". I know I can use raw sql via connection().select_all(...) but I'd like to create an ActiveRecord for this table.
Here is my model in ...
I'm using rspec-rails, version 1.2.6. In a controller test
describe WebsController do ...
I don't seem to have access to the controller object in order to stub methods. For example, the following won't work:
before :all do
@feed = mock_model(Feed)
controller.should_receive(:feed_from_params).and_return @feed
end
I g...
I have a Rails app that is stored in CVS because that is our corporate standard. It needs to be deployed to a single production server that is running Rails using Apache and Phusion Passenger.
About the production server:
RedHat Enterprise Linux 5.1
The app is used internally at our company, not hosted externally.
I have root acce...
Hi,
I've got these tables:
**Sites**
:has_many :blogs
:has_many :pages
**Blogs**
:belongs_to :site
**Pages**
:belongs_to :site
:belongs_to :blog
Basically, I want to be able to create Pages that are either related to a Site OR related to a Blog with routes like this:
/blogs/1/pages/1
/sites/1/pages/2
With my current setup, my Pa...