Hi,
I have a rails app with a wordpress blog sellotaped on the side (totally separately at /blog).
The client want's to the latest blog post on the main homepage of the rails app, so I need to do a one-off mysql query to the word-press database. How would I go about doing this in the rails app. The word-press is completely sperate from...
The rails app I have allows users to manage holiday homes. Each property has it's own
"website/homepage" within my app and a user can tweak the content, it works well,
quite pleased so far. Typical rails approach to the resources so the URLs to a particular property look like this for the "homepage" of a particular property.
localhost:3...
I have a model called a Statement that belongs to a Member. Given an array of members, I want to create a query that will return the most recent statement for each of those members (preferably in one nice clean query).
I thought I might be able to achieve this using group and order - something like:
# @members is already in an array
@...
I have this Class which response to perform to be run by "Resque", I have an error
at this line recipient.response = response.body wich is undefined method response=' for #<Hash:0x00000003969da0> I think that because the worker and ActiveRecord can't work together.
P.S I already loaded my environment and this class placed in lib directo...
I have a rails application (which acts like some sort of load balancer for a group of printers) that needs to do some background processing. The background processing logic needs to iterate over all available (non busy) printers and send a print job via TCP socket to each one as long as there are jobs present.
I know there are several s...
If I have an Auction record, which has many Bids associated with it, out of the box I can do things like:
highest_bid = auction.bids.last(:all, :order => :amount)
But if I want to make this clearer (since it's used in multiple areas in the code), where would I define the method:
highest_bid = auction.bids.highest_bid
Is this actual...
Sorry for asking this again but i did n't get any answer so i am asking ,i have rails application thats uploading some large file (2gb) but these upload are only possible with google chrome but using Internetexplorer only 1 gb of file being uploaded after that meas more than 1.5 gb IE throwing saying like
Internet Explorer cannot displa...
Hi all,
I have a controller that has a value that I want to pass to the rhtml. I already managed to get the value correctly, and based on that, I need to do an action in the rhtml. For code snippets,
def getsubtable
@subtables = Haus.find(params[:bewohner_id])
from the method above, when I debugged it, I can get the correct v...
I am making an app where several users work towards a common goal grouped under an account.
What would be a better structure for my urls?
Subdomains: some-team-name.app.com
Directories: app.com/some-team-name
For example, Basecamp uses subdomains.
Do clients think better of your web-app if it uses subdomains?
In my humble opinion it...
And as a result its not passing validation.
This is my embedded form :
- form_for [@organization, @referral] do |f|
= f.error_messages
= render :partial => 'referral_fields', :locals => { :f => f }
= f.submit "Submit", :class => "button"
#_referral_fields.html.haml
.grid_7
.grid_1{:style => "width: 64px;"}
= f.label :o...
Frustratingly my laptop has Rails 3 on it, although I cannot find much supporting documentation on how to use Rails 3, excepting the API reference.
There appears to be a significant amount about regarding rails 2.2. Would you recommend downgrading and learning 2.2 or just plough ahead with 3 and hope for the best?
...
We're rewriting a site using Rails, and the old site makes extensive use of jQuery v1.4 in its templates. We'd like the old scripts to keep working, but we'd also like to use rails' javascript helpers for our own new scripts. jRails sounds like what we want, but it only seems to support jQuery 1.3. Is there a more up-to-date fork of j...
This feels like a really bad idea on implementation and I'm not sure of the speed savings given the potential cost in memory.
Using Dalli and Memecache to store a set of data that gets pulled on every page request that needs to be paginated. Its a lot of data so I'd really rather not keep hitting the database if possible, but I also don...
Hi all-
I have an application which has achievements that users can earn. I'd like to display these achievements when a user earns them. The system_messages plugin as rec'd here seems to be perfect, but it is not compatible with rails 3. Are there any rails 3 alternatives that would fit the bill, or am I stuck reinventing the wheel?
...
Hello,
My cucumber scenario tests if my news can be create without a title. This must show "You must specify a title.".
In my news model, I have:
validates_presence_of :title, :message => I18n.t(:specify, :what => 'a title')
and in my en.yml have got :
specify: "You must specify %{what}."
but when I run my test, the result is "...
I am using the import_with_load_data_in_file plugin to load large amounts of data quickly.
It works fine in console.
However, when calling it from a Rake task, I get:
undefined method `import_with_load_data_in_file' for #<Class:0x1038cd9e0>
That doesn't really make any sense. The plugin is installed, it's included in the model, and ...
Hi guys,
I am building a Rails application that works with videos. I am using an encoding service that encodes my video and places the encoded file along with some thumbnails in a specified location on my s3. I am able to access the video via AWS:S3 like so:
AWS::S3::S3Object.find 'videos/36/base/video.mp4', 'my-bucket-name'
-- or -...
I have three classes with the following associations:
class Technician < ActiveRecord::Base
has_many :tickets
has_many :services, :through => :tickets
end
class Ticket < ActiveRecord::Base
belongs_to :technician
has_many :services
end
class Service < ActiveRecord::Base
belongs_to :ticket
belongs_to :technicians
end
W...
I need to test two things:
that certain old paths are correctly redirected to certain new paths
that the redirect is a 301, not a 302.
I'm using Capybara for my acceptance tests, but that can't handle #2. I can test that the redirect happens, but it happens silently, so I can't see that it was a 301.
Controller tests can't handle #...
I have the following for which allows for creating or updating a record:
<%=form_for [:project, @permission], :remote => true do |f| %>
... You can change roles in the form... (This works great for new or existing records)
<% end %>
Inside the form, I want to provide an option to delete/destroy the permission. So I added:
<%= link_t...