I have 3 models (Users - Membership - Community)
The users can become members to many communities. For this I made a Membership that contain the user_id, community_id.
After connected, the user have to choose a community. The model User as a community_id that contain that unique community.
When editing, he would be able to change this...
Dear experts,
I have an library of scripts I would like to implement on the client side of my rails application;
In the View, I know that I can do the following.
<%= javascript_include_tag 'folder/script.js' %>
..
And because there are so many separate script files, this process is very time wasting and redundant.
I know that there...
Hi,
I'm converting pdf files in my Ruby project. I'm using the pdf toolkit gem for this.
The documentation shows how you can use pdftotext
pdftotext(file,outfile = nil,&block)
In my project I am converting a PDF file without any arguments and can just do this:
PDF::Toolkit.pdftotext("file.pdf", "file.txt)
If I run it from...
I've got a form_for form, and within it, I'm using a form helper check box. The model has a field that's a boolean value, but I'd like to be able to display it on my form in terms of its converse since I think that's easier for users to understand.
Is there any way for me to have a Rails form helper act as if the model's boolean field i...
I use Heroku to deploy my Rails apps.
But I thought about learning Chef to automatically set up the development infrastructure, but Im not sure.
So to put it very simple, are there any reasons for me to learn Chef?
...
Hi everybody,
I am wondering how to integrate node.js on a rails app (for learning purpose).
Based on Michael Hartl tutorial (http://railstutorial.org/) I realized a basic twitter clone with rails and want to get user microposts in real-time without the use of comet or juggernaut. (the application is hosted on heroku)
For the moment, ...
I have a bit of a complex situation. I am building an iPhone app with a rails backend. There are two model objects, a chat session and a person. They are defined as follows:
class Person < ActiveRecord::Base
belongs_to :chatsession
end
class Chatsession < ActiveRecord::Base
has_many :people
belongs_to :leader, :class_name => "Person"
...
For some reason, I find it really irksome that the files for each testing framework (rspec, test::unit, cucumber, etc.) live in a separate folder in the top level of my app. Is there a strong reason these directories should be scattered about instead of consolidated like gems/plugins in the vendor directory?
If there isn't an actual ...
The end goal is to create a helper found at the end called show_status(contact,event).
Event can be any object, Email, Letter, etcetera. The combination of an Email template sent to a Contact is a specific record ContactEmail. Because each event has a different corresponding Model I need to do the .find on, I have duplication. There ...
I am getting this error in maybe one out of 50-100 requests. I am running 10 Thin instances behind nginx and I don't think that my load is high enough to max out the usage in all 10 instances.. and I would expect nginx to wait even if all instances were busy (maybe not??). Has anyone else seen this before? I am trying to figure out a ...
I need to query mulitple apis to get certain data for each user. I need to do this as a background task. Now there are a lot of users. And ideally I would like all this to happen in parallel. So I could insert a job of each user/api combination. And say have 4 delayed_job workers process all the jobs.
The problem I am facing with this,...
I am using twitter_oauth gem for Rails to implement Twitter posting feature. I currently got my app to ask the user for Deny/Allow access of my app. However, after that when I try to publish, nothing happens. And, as I debug, I got the following error
request: /1/statuses/update.json
error: Invalid / expired Token
I believe the consum...
I am trying to
1) post some XML to my Rails App (without using forms)
2) have my Rails App then parse the posted XML to create entries within my database
For example, I'd like to post
<transaction>
<date>12-01-2010</date>
<amount>1.00</amount>
</transaction>
<transaction>
<date>12-02-2010</date>
<amount>2.00</amount>
</transa...
What are best practices for managing custom logging in Ruby? Should I be monkeypatching logger to do what I want? Or extending from it? Or delegating? What's the rubyish way? I'm sick of custom hacks for this; I'd like something cleaner, and ideally more elegant.
...
I tried act_as_solr_reloaded plugin for searching option in my project
I have two models which are brand and sku and its association are
class Brand < ActiveRecord::Base
acts_as_solr :include => [:skus],:fields => [:id,:name,:description,:active]
end
class Sku < ActiveRecord::Base
acts_as_solr :include => [:brand],:fields => [:id,:nam...
Can I Render Json but from file? Not:
render :json => Some_object
...
In Rails while using activeRecord why are join queries considered bad.
For example
Here i'm trying to find the number of companies that belong to a certain category.
class Company ActiveRecord::Base
has_one :company_profile
end
Finding the number of Company for a particular category_id
number_of_companies = Company.fin...
I have a query that pulls stats which I would like to place on the footer of every page of my application. So natural I'm putting it in the application.rb, but the statistics in question don't change throughout the day generally...
Basically in the footer it will say:
Currently, 46 Countries, 75 Cities, and 20,000 locations.
But I w...
My server is running on IIS6, and i having trouble with setting up rails with IIS.
1st) is there any posible way to run Nginx on a domain:80 while therest:80 are running on IIS?
2nd) How should I make it work on IIS6 because despite follow the instruction here http://mvolo.com/blogs/serverside/archive/2007/02/18/10-steps-to-get-Ruby-on...
Hi all,
I recently started playing around with Spreecommerce but I'm having a little trouble with Taxons and images. What I need is a custom size image for each Taxon. I have worked out how to change the default sizes of images in foo_extension.rb but this only works for Products. Taxons it seems have icons not images. So how can I chan...