Hi all
i've developed before_filter - http://gist.github.com/138659 and in
tests like
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:articles)
end
i see
test_should_get_index(ArticlesControllerTest):
NoMethodError: You have a nil object when you didn't expect it!
You might hav...
Hello,
all I want to do, is to fetch the lastest item from my models and
have them in an array sorted (freshest items first) by the attribute "updated_at".
Somewhere is an error, but I can't find it:
@results = Array.new
Note.find(:all, :limit => 3, :order => "created_at DESC").each do |item|
@results << item
end
Pictur...
Hello everyone.
I have this piece of code in a model that sets a start date and end date according to the time of the day that the method is run.
Let's jump right into the code example:
#MODEL
now = Time.now
if now.hour >= 17 && now.hour <= 23
#night
n = now+1.day
startd = Time.local(now.year, now.month, now.day, 17, 00, 0...
I have multiple models that need to have their history kept pretty much indefinitely or at least a very long time. The application I would keep track of daily attendance statistics for people in different organizations, and a couple of other similar associations. I've realized that I can't ever delete users due to the user not showing up...
I have the following 3 models and relationship between them:
class Calendar < ActiveRecord::Base
has_many:fiscalcalendars
has_many:voucherdatas ,:through => :fiscalcalendars
end
class Fiscalcalendar < ActiveRecord::Base
belongs_to :calendar
has_many :voucherdatas
end
class Voucherdata < ActiveRecord::Base
has_many :fisc...
hi
I am trying to deploy my app to my server using capistrano
I am in a Git Bash and have commited everything and setup deloy.rb file and remote repo on Github.
Now when i try and cap command even cap -h from Git bash i get error :
sh.exe": cap: command not found
I am in the correct dir.
It seems Git Bash is not linked to capistran...
I have a model that has lots of instances of a child model (a widget has many parts). Each part has a label and a value.
What I am trying to achieve is when creating a new widget, I get a form listing all the potential parts and a field where I can enter the value. At the moment the list of potential parts is in an array in the Widget...
Rather than using the latest Rails gem for my application, I like to have the code local in my own git repository, which means putting it in vendor/rails.
There are a couple of ways of doing this: downloading the source for the particular branch/tag I want to run and committing it to my repository, or using git submodules.
Submodule...
I want to have a comments section in my app that looks like this:
response1
response1a
response1b
response1b1
response2
response2a
response2b
response2c
response2c1
response2c1a
response2c1a1
response2c1a1
response2c1a1a
response2c1a1a1
Assuming I do this by using HTML such as the following:
<div cla...
hi all
i am having a problem with deploying my application to my server.
i have msysgit, github and capistrano installed and working.
i have successfully pushed my app to github and can successfully run cap deploy:setup to setup on my server from my local machine.
BUT..
when i run cap deploy:cold it asks me for my passphrase to conn...
I think there are a lot of places where my design may be screwing this up. I have very limited experience with Rails though. This is happening in Rails 2.3.2 with Postgres 8.3.
We've got two tables in our DB. One called "survey" and one called "survey_timepoint". A survey can have multiple time points so in the survey_timepoint tabl...
I use before_filter :login_required on a controller, and everything behaves as it should - a user who isn't logged in is bumped to sessions/new. But given that I'm doing this on the root url, I'd like to avoid having an actual redirect (to not show /sessions/new) in the user's browser bar. How would I tweak?
...
I've deployed a Ruby on Rails application using mod_rails and nginx over Capistrano, and it's working perfectly, but I have a baffling problem.
When I run the following command on the server:
SHOW TABLES IN application_production;
MySQL returns:
Empty set (0.00 sec)
I know that information is being written to the database because ...
I've been struggling with an issue with ActiveResource for a bit now: when a hostname resolves for an ActiveResource request, but there's no server on the other end to return information, ActiveResource's timeout value doesn't work. The request just hangs.
After reviewing the ActiveResource code, I've realized that this is because the u...
Hi all
I am having a problem with deploying my application to my server.
I have msysgit, github and capistrano installed and working.
I have successfully pushed my app to github and can successfully run
cap deploy:setup to setup on my server from my local machine.
BUT..
When I run cap deploy:cold it asks me for my passphrase t...
Hi,
I tried to get the facebooker gem to work with jQuery, but it does not even render the facebook connect buttons, once I load jquery.js instead of prototype.js and use
init_fb_connect “XFBML”, :js => “jquery”
I tried it with the example
http://www.madebymany.co.uk/tutorial-for-restful_authentication-on-rails-with-facebook-connect-in...
In my rails application, I have a background process runner, model name Worker, that checks for new tasks to run every 10 seconds. This check generates two SQL queries each time - one to look for new jobs, one to delete old completed ones.
The problem with this - the main log file gets spammed for each of those queries.
Can I direct t...
When I have a specific action that I don't want to check the authenticity token on, how do I tell Rails to skip checking it?
...
Hi,
I'm trying to migrate to nginx from Apache using Passenger in both instances to host a Rails app. The app takes a request, which is for an image- if the image exists at /system/logos/$requestedimage then it should get served, or it should be allowed to hit the Rails app to generate it if needed (where it is then cached to /system/lo...
I want to share code not related to views between several controllers in my Rails app. Where in the directory structure should I place it?
EDIT: the code in question if something all controllers use to determine how they render the model data
...