There are many questions posted with great answers, but nothing I found met my requirements. Hope you guys can help.
I will be building a niche social site platform based on Ruby on Rails and will integrate trusted popular gems to save time. The final product will be launched where users can sign-in to use the basic services for free, a...
I want to verify that an exception is being thrown in some function tests by calling get :methodname, :params. I had expected just making this call and then verifying the result is a 500 would be sufficient, but rails is failing the test as soon as the exception is reached in the get. While I figure I could go ahead and wrap the get in a...
Is there a way to tell a running "script/server --debugger" to pause execution and open the debugger prompt (other than sticking a "debugger" statement in my code)? Similar to CTL-C in gdb.
I would like to do this, so that I can set a breakpoint in Base.update_attributes without having to put "debugger" in my own function (and having to...
I am trying to come up with a good name for a resource which relates people/users to events they attend (many to many relationship). I have thought of attendance but it doesn't really sound great...a person has many events through attendances. I have thought of invitation as well but I would want to reserve that in case I have some funct...
I've set up a resource in routes.rb:
map.resource :papers
which is reflected in the output of rake routes:
new_papers GET /papers/new(.:format) {:controller=>"papers", :action=>"new"}
edit_papers GET /papers/edit(.:format) {:controller=>"papers", :action=>"edit"}
papers GET /paper...
I'm creating an API for my Rails app, and I want to track how many times a user calls a particular API method, and cap them say at like 1,000 requests per day. I'm expecting very high request volumes across multiple users.
Do you have a suggestion as to how I can keep track of something like that per user? I want to avoid having to wr...
According to the Rails API (snippet below), the optimal way to receive mail is by creating a single Rails instance within a daemon that gets invoked by a MTA whenever new mail arrives.
My question is: how do you pass data to that daemon when new mail arrives?
========================
Rails API Snippet
To receive emails, you need to i...
Hey, I'm new to Rails and Ruby in general. I was wondering if it's possible to use an embedded ruby css file (css.erb), similar to using html.erb files for views.
For example, I'm using
<%= stylesheet_link_tag "main" %>
to link to my main.css file in public/stylesheets, but when I change the file extension from main.css to main.css.e...
Hi, I have just set up ruby in Aptana studio and am getting the following error when trying to migrate the db. I am a complete noob. Anyone have any idea as to where I need to be looking first?
thanks.
(See full trace by running task with --trace)
>rake db:migrate --trace
(in C:/Users/7/My Documents/Aptana Studio Workspace/testing)
** ...
Hi all
In a typical User - Post - Comment model in Rails, every user can create a Post and also can create Comment, question is how to grab every user latest comment on specific post.
Example:
Post A have 3 user making comment
User 1 have comment 1, 2, 3, 4, 5, 6
User 2 have comment 1, 2, 3, 4
User 3 have comment 1, 2
So the view I ...
I'm trying to get the Vestal Version gem to work, but I keep getting this error:
>> Song.first.version
=> 8
>> Song.first.revert_to(7)
NoMethodError: undefined method `>' for #<Version:0x231bddc>
from /Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/attribute_methods.rb:260:in `method_missing'
from /Library/Ruby/...
Using Your Ruby Gem(s)
You will need to add /home/username/ruby/gems to the include path.
You can do this by **adding the following code to your script**:
$:.push("/home/username/ruby/gems")
What script are they referring to? This is vague... Where do I add directories to the ruby include path?
...
I'm trying to manually manage some geometry (spatial) columns in a rails model.
When updating the geometry column I do this in rails:
self.geom="POINTFROMTEXT('POINT(#{lat},#{lng})')"
Which is the value I want to be in the SQL updates and so be evaluated by the database. However by the time this has been through the active record mag...
I'm installing Ruby 1.9 and Rails 2.3 in Ubuntu 9.04. I want to learn about Cucumber. Is Cucumber broken under Ruby 1.9.1 and Rails 2.3.2?
...
@posts = Category.find(params[:id]).posts
How can I order the results with column from the posts table? For example on the posts.created_at column?
...
I have a server side app written in Rails using the authlogic plugin. I am not sure how to login to the rails app from my iphone client. I think I know how to write get/post code in Obj C, but I'm not sure what the best approach is of authenticating with my rails server. Here is what the server side HTML looks like when you go to this...
In PHP I can do this:
$request = "http://www.example.com/someData";
$response = file_get_contents($request);
How would I do the same thing in Ruby (or some Rails method?)
I've been googling for a half an hour and coming up completely short.
...
I have experience in client-server application development in C/C++ on Windows platform. I would like to get into web based application development. I have an understanding of web application development concepts in general. Which web application development framework would be the quickest to learn/master? I am currently learning .NET an...
I've looked at the rails guide to testing but I can seem to get fixture data from inside my test. I have a fixture:
one:
pay_period: one
employee: kent
cpp: 50
ei: 40
tax: 100
vacation_pay: 30
Then I have a test as per below (where EmployeePayPeriod is a model)
require 'test_helper'
class EmployeePayPeriodTest < ActiveSu...
Hi everone,
I'm trying to generate model diagrams using the railroad gem. I have managed to generate a diagram for a different app, but I'm trying to get my head around some "legacy" code, and keep running into problems.
I know very little about ruby or rails, so any help would be appreciated...
Basically, I run:
$ railroad -v -M
...