Right now I'm storing the user who last updated the state of my model in the state_last_updated_by_id field and the time the state was last updated in the state_updated_at field. Then I define methods like this:
def published_at
return unless state == 'published'
state_updated_at
end
def published_by
return unless sta...
OSX 10.5 comes with Ruby 1.8.6 I believe, but I see a lot of tutorials that recommend installing the latest version of Ruby from source. I've done this in the past and it's caused minor issues down the road if I install something which expects Ruby to be in the default location and it's not (Phusion Passenger pref pane, for instance). ...
Hi,
I'm using Ruby 1.9.1 with Rails 2.3.4 My application is to handle text input
If I try something like (the inside quotation marks look different)
text = "”“"
I get the following error:
#<SyntaxError: /Users/tammam56/rubydev/favquote/lib/daemons/twitter_quotes_fetch.rb:54: invalid multibyte char (US-ASCII)
/Users/tammam56/rubydev...
Inside a given controller "BobsController" - is the controller argument on the redirect_to method optional, so that:
redirect_to(:controller => 'bobs', :action => 'index')
is the same as:
redirect_to :action => 'index'
when being used inside the BobsController class? I assume because the controller is derived from the current cont...
Here is the specific XML I ultimately need:
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<email>[email protected]</email>
<first_name>Joe</first_name>
<last_name>Blow</last_name>
</customer>
But say I have a controller (Rails) that is sending the data to a method, I'd prefer to send it as a hash, like so:
:first_name => 'Joe...
Here is a simple example of the problem.
http://gist.github.com/235729
In short, if you have a index.rhtml with:
<%= link_to_function "A link to insert a partial with nested insert_html" do |page|
page.insert_html :top, :with_a_nested_insert_html, :partial => 'example_partial_with_nested_insert_html'
end %>
And a _example_...
Hi,
I have a form with a time_select and a jquery datepicker,
I want to be able when I submit the form to merge the values of the time_Select and the datepicker into one datetime of my ActiveRecord model ...
Is there an elegant way to do that ?
Should I do it client or server side ... I'd like to keep my action as simple as that :
d...
Hi,
I am using acts_as_taggable to create a tag cloud for my application. I have a model 'Question' which is using the acts_as_taggable plug-in. I basically want to filter the tags for the question model.
I also have a 'Subject' model. So the relation between subjects and questions is that a subject has many questions, and a question ...
Is it possible to make a model that uses a different table dependent on an association.
...
I'm using the jQuery Form Plugin on a big ass form which includes some file fields. The back end is Ruby on Rails.
I'm having trouble getting Rails to recognize the POST request type to be 'text/javascript' even though I believe I am setting it correctly.
The form looks like:
<form id="listing_form" method="POST" enctype="multipart/f...
Let's say you're implementing rails app for a snowboard rental store.
A given snowboard can be in one of 3 states:
away for maintenance
available at store X
on loan to customer Y
The company needs to be able to view a rental history for
a particular snowboard
a particular customer
The rental history needs to include temporal dat...
Lately I seem to have noticed a trend amongst some RoR developers, that is using RubyEE/Passenger/Apache type setups during their development process.
Besides the obvious "use what your clients use" idea, do these technologies enhance the development environment in any way compared to what the vanilla mongrel stack gives you ?
...
So far I have been building my Rail app on a Mac OS X box using TextMate.
It's just me, so I haven't used Git. I have just opened and closed the code in the file system, used an AppleScript to take annotated snapshots at key moments, and let Time Machine take care of the rest.
I've just ordered a Windows laptop which I'll use for the s...
I am working on a project for a client of the IT company I work for and I am convinced that Rails is perfect for it. I have a meeting in the next day or so, where I am afraid I am going to get bombarded with "why Rails?" type questions, and no doubt, a whole bunch of rhetoric like "Rails doesn't scale", "Rails is just a CMS" and the tho...
I'm fairly new to Ruby on Rails here.
I have 2 migrate files that were provided. The first one, prefixed with 001, creates a table and some columns for that table. The next migrate file, prefixed with 002, inserts rows into the table created in file 001.
Running the migration (rake db:migrate in command line) correctly creates the tab...
I know that questions about this topic exist, but i would like to know if anyone knows a solution for rails :)
I'm using a text_area_tag helper, and the contents that i want to display contain HTML tags.. any idea?
...
It's an application that we use internally at the office that I would like to offer as a hosted service for anyone.
How can I do that without making major code changes?
The first thing that occurs to me is to have the app select which database to connect to based on the domain.
So each instance of the app would have its own databas...
My application mailer works fine in development on my own machine but on the server it doesn't work the way I want.
I know the server is perfectly capable of relaying the emails requested because I can get it to work directly from the command line and if I put:
ActionMailer::Base.delivery_method = :sendmail
directly in my environment...
I've heard a lot about rails, what is it and how does it work?
...
I've got the following situation setup to model a Customer with multiple addresses and a reference table for the type of address. The data model is
Customer - Address : many to many relationship, represented with a join table called 'Location'.
LocationType - Location : one to many, so that a locationtype (eg 'work', 'home') can have ...