Hey guys, I'm trying to select random data from the database in Ruby on Rails. Unfortunately, sqlite and mysql use different names for the "random" function. Mysql uses rand(), sqlite use random(). I've been pretty happy using sqlite in my development environments so far, and I don't want to give it up for just this.
So I have a soluti...
Hello,
I need to know how to pass a tax amount to PayPal Express Checkout using Active Merchant and rails. Everything is working (completing transations) except I can't figure out for the life of me how to set the tax.
Thanks for your help!
...
Hi,
I have the following situation
class RecordA
has_many :recordbs
end
class RecordB
belongs_to :recorda
end
RecordA has many recordbs but only one of them may be an active recordb. I need something like myRecordA.active_recordb
If I add a new column like is_active to RecordB, then I have the potential problem of setting two r...
Hi all,
I want to create a default value for an attribute by defining it in ActiveRecord. By default everytime the record is created, I want to have a default value for attribute :status. I tried to do this:
class Task < ActiveRecord::Base
def status=(status)
status = 'P'
write_attribute(:status, status)
end
end
But upon ...
Hi,
for a new App I want to use paperclip to store Files to S3. I already have installed the aws-s3 gem for another app. That seems to cause some problems, because Paperclip should use right_aws but is trying to use the aws-s3 gem. But I don't want to remove the aws-s3 gem from my system. Is there a way to solve this conflict? Maybe by ...
I want to handle two kinds of global configuration settings:
Settings which can be altered by the user, like if notification mails for certain events are sent or not.
Settings which are tied to a specific product edition, like disabling a feature in a free version, which is only available in the commercial version.
What's the best w...
It only happens in production, when we update some of the records through browser, the change was not saved. it does not seem to be a cache problem as we verified that the data in mysql was still the old data. However, the controller did get hit and flash message returned as if the change was made successfully.
However, we can make the...
I try to integrate the Tinymce wysiwyg-editor into my adminpage whitch i create with streamlined framework.
I wan to reset all textareas with this line:
<%= tinymce_tag('comment[body]', 'Your comment goes here ...') %>
but where i can find in streamline part to make this available?
Can i edit that in this file? -> ROOT_PATH/str...
I am creating a simple facebook application using Ruby on rails and I am following the liveRail tutorial available here
http://www.liverail.net/articles/2007/6/29/tutorial-on-developing-a-facebook-platform-application-with-ruby-on-rails
The problem that Im facing is that when I launch my server it throws an error saying that it cant f...
Which PHP framework should I choose if I want to be able to develop in both PHP and Ruby and Rails without having to make too much of a mental jump when I move from one to the other? It does not have to be an exact copy, but should have most of the basic features of Rails.
That is, it should include similar routing (either /controlle...
Hello, have a problem creating my new table in SqlLite3
I have created this migration using the scaffolding generator:
class CreateTimes < ActiveRecord::Migration
def self.up
create_table :times do |t|
t.integer :regsite
t.integer :user_id
t.timestamp :added
t.integer :time
t.text :note
t.time...
If I use permalink_fu on a text field I get this for the resulting permalink:
http://localhost:3000/243webb4ee4ff2227230b4232438591810c35d3f
instead of
http://localhost:3000/where-is-my-lost-cat
I assume this is because the text field becomes a blob in the database and permalink_fu only knows how to operate on string fields.
How ...
I'm reading through a open source Rails project code and I see SQL statements in the development log that I can't map to the Rails code, i.e., I have no idea where it is called from. I tried ruby-debug but it seems to be out of sync with the log file output and the code itself, so it hasn't been too useful. Any suggestions on how to debu...
I am developing an Rails 2.3.1 Web site. Throughout the Web site, I need to have a form for creating Posts on various pages (Home page, Create Posts page, Post listing page, Comment listing page, etc. -- suffice to say this form needs to be on many pages served by a variety of controllers). Each of these pages displays a wide variety of ...
Noob Alert. I am learning RoR, have Windows 7, so I downloaded the latest BitNami stack and installed that.
Ran through the Rails guides and created my first application 'A blog' and everything worked fine.
However, I want to move on to my second rails app, but I don't know how to navigate to it. The first one was at localhost:<port>, ...
I need a straightforward, easy to understand answer on this one. I'm building a user control panel for administrative users to create/edit/delete users of the system through a web interface (on top Authlogic and rails-authorization).
On the /users view, I list all the users, then I have them broken down by role.
At the end of each rol...
I'm trying to make attributes equal predetermined values, and I'm not sure if I'm doing that efficiently with the following (in my orders controller):
def create
@order = Order.find(params[:id])
@order.price = 5.99
@order.representative = Product.find(params[:product_id]).representative
@order.shipping_location = SHIPPING_LOCATI...
Two models, an Account model (has_many :users) and a User model (belongs_to :account, :dependent => :destroy).
My User model has the following:
def protect_master_user
unless User.find_all_by_account_id_and_is_master(self.account_id, true).count > 1
false
end
end
I'm trying to protect the master users from being deleted. How ...
Are there any best practices / plugins for scoping users across different clients.
Currently we are validating the uniqueness of the email address on the assumption that these will be unique throughout the system
How would you recommend that we extend this approach to allow us to scope the uniqueness to a specific client-id...
Dom
...
I have a problem in trying to link a stand with two checkboxes which are resident & communication, and they seem to be stored separately if more than one stand is choosen.
If I have one stand the parameters seem to be stored in the correct manner inside a hash of an array, but once I add another stand to that same array it seems to swap...