Hi,
i have problem with has_many_polymorphs, maybe you can help me.
I have some models
class Issue < ActiveRecord::Base
has_many_polymorphs :things, :from => [:applications], :through => :relations
ene
class NewsArticle < ActiveRecord::Base
has_many_polymorphs :things, :from => [:applications], :through => :relations
end
class Ap...
Hi there,
I have a flex component inside a rails view. I'd like this component to place a post request to rails, so that rails renders another view. But I'm struggling with the authenticity token. I tried passing it as a URLVariable, but characters like '+' and '=' mess it up, and I get invalid authenticity_token. I'm using navigateToUR...
I am trying to create a collection_select that is dependent on another collection_select, following the railscasts episode #88..
The database includes a schedule of all cruise ships arrival dates. See attached schema diagram,... (The arrow side of the lines indicate has_many, the non-pointy side indicates belongs_to)
In the "bookin...
I'm working on a Rails application. I have a Module called Animals. Inside this Module is a Class with the same name as one of my Models (Dog).
show_animal action:
def show_animal
require 'Animals/Bear.rb' #Works
require 'Animals/Dog.rb' #Fails
end
So the first require definitely works, the seconds fails.
MissingSourceFile (no s...
Rails and MySQL:
I have a table with several boolean columns representing tags. I want to find all the rows for which a specific one of these columns is 'true' (or I guess in the case of MySQL, '1'). I have the following code in my view.
@tag = params[:tag]
@supplies = Supply.find(:all,
:conditions=>["? IS NOT NULL and ? !=''", @ta...
Does anyone know if pickle is compatible with jruby? I just installed cucumber and cucumber-rails. I then tried gem install pickle and it installs, but a script/generate pickle yields
Couldn't find 'pickle' generator
I did everything according to the readme no dice. Anyone have any experience with this:
specs
jruby-1.4.0
rail...
Given the following Ruby-on-Rails code (1.8.6, 2.3.5):
class MyClass < ActiveRecord::Base
has_many :modifiers,
:conditions => ["affects_class = ?", self.name],
:foreign_key => :affects_id
end
What I'm trying to do is to automatically set the affects_class column to 'MyClass'. In other words:
myInstance = MyClass.find(:firs...
when I execute
Mathieu$ /Users/Mathieu/.gem/ruby/1.8/bin/wsdl2ruby.rb path --wsdl https://www.arello.com/webservice/verify.cfc?wsdl --type client --force
I get
at depth 0 - 20: unable to get local issuer certificate
F, [2010-05-06T10:41:11.040288 #35933] FATAL -- app: Detected an exception. Stopping ... SSL_connect returned=1 errno=0...
So I have this create form to create schedules where there is a bunch of fields and one of them is seasons. And seasons table has a field called 'is_current' which if set to 1 tells us that it is the current season. When the create form is display , I want the current season to be selected by default in the seasons drop down. Any help wi...
Hello, I am using Ruby on Rails and need to create a view that allows the creation of records through a HABTM relationship to another model. Specifically, I have the following models: Customer and ServiceOverride, and a join table customers_serviceoverrides. Using the customer view for create/update, I need to be able to create, update a...
I need to populate my production database app with data in particular tables. This is before anyone ever even touches the application. This data would also be required in development mode as it's required for testing against. Fixtures are normally the way to go for testing data, but what's the "best practice" for Ruby on Rails to ship th...
Great ruby on rails examples of almost real world applications:
Can somebody give some links of sites that have such codes using the best practices in structure, implementing it, models, controllers, security, views, caching, modularizing and so on? thanks
...
I have 3 models: Questions, Answers, and Profiles (I know, it should be called "Users"). When you view a question Q, I query the database for the answers to Q. (They are linked by id.) In the view, the current user has the option to delete his answer by clicking on the destroy link displayed next to his answer:
%table
%tr
%td
...
There seems to be a time difference on heroku server.
>> Customer.last.id
=> 584
>> Customer.last.created_at
=> Thu, 06 May 2010 01:43:20 UTC +00:00
>> Time.zone
=> #<ActiveSupport::TimeZone:0x2b1dec47e5c0 @utc_offset=0, @tzinfo=#<TZInfo::DataTimezone: Etc/UTC>, @name="UTC">
>> Time.now
=> Wed May 05 19:05:15 -0700 2010
>> Time.now.zon...
Say I have a router helper that I want more info on, like blogs_path, how do I find out the map statements behind that in console.
I tried generate and recognize and I got unrecognized method error, even after I did require 'config/routes.rb'
THanks
...
hi guys,
i am wondering is there a convenient function in rails to convert string with negative signs into a number. e.g. -1005.32
when i use to_f method, the number will simply become 1005 with the negative sign and decimal part being ignored.
thanks in advance!
...
Hy,
I was thinking that all my website will have use of cells, using the known plugin cell for rails, so this is my idea:
A table that contains 3 fields: id, view_name and layout. the layout will be a serialized hash.
When a request is made, the layout field is requested and then in the view, default layout, will be unserialized the la...
Object.update_attribute(:only_one_field, "Some Value")
Object.update_attributes(:field1 => "value", :field2 => "value2", :field3 => "value3")
Both of these will update an object without having to explicitly tell AR to update.
Rails API says:
for update_attribute
Updates a single attribute and saves the record without going throug...
Can anyone explain to integrate the MYOB in rails application
...
I have two Models: Campaign and Contact.
A Campaign has_many Contacts.
A Contact has_many Campaigns.
Currently, each Contact has a contact.date_entered attribute. A Campaign uses that date as the ate to count down to the different Events that belong_to the Campaign.
However, there are situations where a Campaign for a specific Conta...