I'm using factory_girl + rspec on Rails 2-3-stable:
Test:
context "test" do
before(:each) do
@profile.stub!(:lastfm_enabled?).and_return(true)
end
it "should be able to scrobble if true" do
@profile.update_attribute(:lastfm_scrobbling, true)
@profile.lastfm_scrobbling_enabled?.should be_true...
From the Game Kit Programming Guide...
Multiplayer allows players interested
in playing an online multiplayer game
to discover each other and be
connected into a match. Depending on
your needs, your application can have
either use Game Kit to connect all the
participants together, or have Game
Kit deliver a list of play...
I have two groups of text:
firstgroup
(some content)
endgroup
secondgroup
(some content)
endgroup
I'm trying to just capture the first group (not the second group). I'm using this regular expression:
firstgroup(.|\n)*endgroup
For some reason, that regular expressions selects both first group and second group (probably because it ...
I am interested in doing this the "Rails Way" on a new application. I would also like to refer to constants in some sort of context to make the code more readable. I have an application where a user can request access to another users's data set. This AccessRequest can have one of the following statuses:
Review
Denied
Approved
I can s...
hi,
I have a nested-model form with a one-to-many relationship between a class Project and class TeamMember, and in the controller, an update function like :
@project = Project.find(params[:id])
@project.update_attributes(params[:project])
Now, I'd like to set some fields that are not set in the form for some of the t...
I'm sure there's an easy answer for this, but not sure how to word it to search for it.
Given that articles belong to users, if I have a set of three different users, how can I access all of the articles written by any of those users with one query?
...
I'm facing a problem with rspec and controllers
i'm spec'ing an update action, so to do it i call the following code:
put :update, :id => "1", :ntp => {:name=>'myservah'}
My controller has the following code:
def update
if @ntp.update_attributes(params[:ntp])
flash.now[:notice] = "Successfully updated ntp."
else
flash.now[:err...
I'm looking for a working gem/plugin for rails3 that does IP geocoding, and ideally, distance calculations. geokit seems to be a popular choice, but it doesn't support rails3 yet.
...
We're creating a client-server model that communicates with an application server (Java clients, RoR server).
We have a few options for the actual data that is going to be communicated:
XML Communication that actually paints the client's screen (a la web-browser)
Communicating just data/permissions/etc. through XML (Entire UI is held ...
I have a field that is serialized to YAML through the default AR behavior. It is currently in an Array of Hashes for examples:
[{'name' => 'hi', 'url' => 'bye'},
{'name' => 'hi', 'url' => 'bye'},
{'name' => 'hi', 'url' => 'bye'}]
Is there a way I can use some basic AR validations on some of these fields?
...
I have an object called human and that object has a field called job. I want users to be able to add their own jobs (which will obviously be added in their own language) but I want to have any job that is a default in the database to be translated when someone does a Human.job, can rails translate the default if it is in the view but not...
Hey all
I am having trouble updating a partial that contains a nested_attributes_for form with AJAX.
My application needs to load a new section of the form based on the event type chosen in the main form. The fields associated with each type are stored in a database table.
At the moment, when I select an event type, the id of the even...
In my rails project i wanna use urls like this
mysite.com/controller/title/action
instead
mysite.com/controller/id/action
How can i now build a redirect to it,
with the following line
redirect_to :action => "show"
it redirects to the id version, how do i have to customize the line to redirect to the url with the title?
...
What is a good, open source RoR 3 forum that can easily integrated to an existing application?
Optional features:
OpenID support
Haml/SCSS templates
Support for smilies, YouTube, images, etc
I'm probably going to change it alot, and I'm still pretty weak in Ruby, so clean, commented code with good practices would be great.
Thanks :)...
I have an application with a product detail page. On that page the user can see prices, descriptions, specifications, all pretty standard stuff. But I want to test this view in Cucumber.
Right now I use factories to generate product identifiers and leave everything else blank. If I add defaults to the factories, then check for those sam...
I installed integrity app these days. and found some issues.
I follow this.
$ gem install bundler
$ git clone git://github.com/integrity/integrity
$ cd integrity
$ git checkout -b deploy v22
$ bundle install
$ bundle lock
$ rake db
at the end steps, I can't find and folders named ".bundle" in the integrity folder.
an...
Is there any difference between:
<%= event_form.fields_for :client, @client do |client| %>
and
<%= fields_for @event, :client, @client do |client| %>
The parent form looks like this:
<% form_for @event do |event_form| %>
...
(Sorry about duplication of question. I put it in the wrong account at first)
Am running a rails application which launches a series of relatively long running scripts using delayed_job and Rinda to farm out the work. At the moment am using a single delayed_job process (rake jobs:work, as am stuck on Windows), a ring server process ...
Hi,
I would like to construct a search query that groups the records by their 'tag' attribute, and finds a certain number of records for each tag group. My 'place' table is as follows:
| ID | name | geom | rating_av | tag |
There are four different tags that a place can be assigned - "city", "food", "hotel" and "attraction". I would ...
Right now i am storing files inside public directory in my application.
I want to upload file to specific path like http://uploadfacility.com.
I have a login and password for that specific path.
http://uploadfacility.com/test?username=test1&password=test1
How may i store files to specific path outside my application.
I need to ...