Each time I typed: gem install rails it asked me for a dll. SO I downloaded the following:
datasvcs.dll, icudt24l.dll, icuin24.dll, icuio24.dll, icuuc24.dll,
libeay32.dll, libmex.dll, libmwservices.dll, libmx.dll, libut.dll,
libz.dll, mpath.dll, msvcrt-ruby191.dll, mvalue.dll, m_dispatcher.dll,
nscrt.dll, readline.dll, sslea...
Warning: Noob here.
I know this is a trivial subject but I'm having a lot of difficulty in figuring out how exactly I can simplify my views by moving parts of them into helpers. For example, I've always read that conditionals in your views are prime candidates for extraction into helpers, but I couldn't really find examples of this, and...
I'm using http://github.com/geekq/workflow to provide a state machine. I'm using ActiveRecord to save state, which means I have a "workflow_state" attribute in the model. I think I want a named_scope for each event in the state machine, so I can find all objects in a given state. For example, assuming a very simple state machine:
workfl...
What is ORM as it applies to Rails and what does it mean?
...
Im trying create a live feed block which identifies the latest data added to a forum discussion and automatically updates a block on another page with the latest posts on that forum.
Im using Ruby on Rails and I would really appreciate any help on this.
(If my question is not clear I hope I can be more specific with one of these exampl...
I use python based as well as rails applications on ubuntu linux. We have functionalities like register, forgot password, reset password, email alerts etc features based on emails. Since now a days, we go on offline development, we want to run a local smtp & pop3 server to send and receive emails.
Emails shall be send via the our web ap...
I'm suffering some weird issue where my delayed_jobs are failing in production. Finally I narrowed it down to the logger. If I comment out my log function calls, everything works. However if I try to log, I get this in the delayed_job handler:
--- !ruby/struct:Delayed::PerformableMethod
object: AR:User:1
method: :load_and_update_wi...
I was going through the error log of my Rails application and found that someone had run into the following error:
"Mysql::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=': SELECT * FROM `tags` WHERE (name = LOWER('?')) LIMIT 1"
I understand the reasoning for this error, h...
I'm currently using the facebox_render plugin for rails, and am trying to get it working without jquery (so using prototype). I've got it 99% functional, but there's one line I'm having difficulty with.
how would I write the following using prototype?
link_to_function(name, "jQuery.facebox(function(){ #{remote_function(options)} })", h...
I searched and tried a lot, but I can't accomplish it as I want.. so here's my problem.
class Moving < ActiveRecord::Base
has_many :movingresources, :dependent => :destroy
has_many :resources, :through => :movingresources
end
class Movingresource < ActiveRecord::Base
belongs_to :moving
belongs_to :resource
end
class Resource <...
Below you can see that I'm calling File.open only once but rspec is telling me it received it 3 times.
def self.import_file(filename)
current_file = filename.split('/').last
destroy_all(["filename = ?",current_file])
unpack_format = "A#{INPUT_FILE_FORMAT.map{|element| element[1]}.join("A")}"
debugger
File.open(filename, 'r')....
Dear colleagues,
A very basic question on Rails. I would like to create a Rails application that, besides the "regular" html view, it can generate a set of XML files. I am aware that I can tailor the templating using the "respond_to" command and using ERB with the templates ???.xml.erb. My question is: suppose that the final document co...
I am writing a simple rails app that caches values from a web service. The web service returns a list of objects that look like this:
<objects>
<object>
<id>12345</id>
<name>obj name</name>
</object>
....
</objects>
Is it okay to use the id coming in as the id for my ActiveRecord object if I am guaranteed ...
Hi,
I am thinking about the best way of including a JS library into rails app supporting :cache => true option for both JS and CSS.
Let me take an example to describe the question: jQueryUI (that's just an example). It usually has the following structure when downloaded:
+jq.ui
+css
+skin1
+images
all_...
Hi
I have Authlogic with activation emails being sent working just fine. The problem is I would like to next this user sign up form in a larger account form.
It seems that when I do this the user information is put in just fine however the User create does not trigger the @user.signup! when nested into a form.
Any ideas on why or wha...
I am trying to have a multiple select box. select box will contain all the stores in the DB but the ones that the user belongs to will be selected.
I'm half way there. I got a select box which has all the stores in the database. I'm unable to select the ones that the user belongs to.
I have the following:
<%= select_tag 'stores[...
I have the following models:
class User < ActiveRecord::Base
has_one :profile, :dependent => :destroy
def before_create
self.profile ||= Profile.new
end
end
class Profile < ActiveRecord::Base
belongs_to :user
validates_uniqueness_of :name
end
And I have the following factories:
Factory.define :user do |user|
...
Untill now I used soap4r as my SOAP-client with Ruby 1.8.x, but now I am moving on to Ruby 1.9.x. Unfortunately soap4r doesn't work with Ruby 1.9.x I just get the "invalid multibyte escape" which seems not solvable, mostly because the soap4r gem wasn't updated since 2007, so I assume the project is dead.
I had a look at handsoap but the...
I know I can use :finder_sql to manually define the SQL to use to fetch associated records, but I'm wondering if ActiveRecord uses the :primary_key and :foreign_key options on an association to generate the joining SQL. It doesn't appear to, but am I just missing something here?
Update: To be more explicit, my question is: Is there s...
In Rails, you can add a block after a named_scope for additional, context-sensitive methods like so:
class User < ActiveRecord::Base
named_scope :inactive, :conditions => {:active => false} do
def activate
each { |i| i.update_attribute(:active, true) }
end
end
end
In this example, the activate method is being defined...