I'm trying to prototype a system in Rails. Essentially, its an abstract relational data model that takes in user input to create nodes of information. Each node can have meta-information associated with it, so some nodes may have CreateDate and DueDate while others may have StartDate, DueDate and PersonResponsible. In this way we're simp...
I've got a PHP application I wrote earlier that I'd like to add a RESTful API to. I'd also like to expand the site to behave more like a Rails application in terms of the URLs you call to get the items in the system.
Is there any way to call items in PHP in a Railsy way without creating all kinds of folders and index pages? How can I ca...
We want to implement a progress bar for file uploading in one of our Ruby application. This needs to show the exact percentage of the upload. However, despite our best efforts we could not find a way to implement a progress bar that exactly replicate the file upload process.
Can you please help us with this?
...
I have found some code `
require 'socket'
host = "download.thinkbroadband.com"
path = "/1GB.zip" # get 1gb sample file
request = "GET #{path} HTTP/1.0\r\n\r\n"
socket = TCPSocket.open(host,80)
socket.print(request)
# find beginning of response body
buffer = ""
while !buffer.match("\r\n\r\n") do
buffer += socket.read(1)
end
response ...
Following is the model. I've already installed Redcloth((4.2.2) and acts_as_textiled plugin on Rails 2.3.2
class Post < ActiveRecord::Base
acts_as_textiled :content
end
Now from console:
[Staging]>> post = Post.new(:title => 'the post title', :content => 'the link is "linked":http://www.cc.com', :user_id => 1)
=> #<Post id: nil, ti...
I have seen many sites which provide the whole list of Rails plugins, Ruby libraries and Ruby gems, but we hardly use few of them and some may not suit our requirement and we spend a whole lot of time searching for useful plugins which suits our requirement.
I have created this poll, people can post useful libraries, gems and plugins wh...
Does anybody know how I can run alternative Rails generators in Netbeans 6.7? I have installed nifty-scaffold and want to want to find how I can run the following command from the IDE:
script/generate nifty_scaffold etc ....
I have installed the nifty-scaffold gem, but it does not appear in the drop-down list when I select 'Generate' ...
I've just frozen my Rails (2.3.2) application together with RedCloth (4.2.2) and deployed it to my shared hosting environment.
When running the application I get an error saying another version of RedCloth is already activated (4.2.2) when trying to load an older version.
I reckon this problem is because the hosting environment has an ...
For three days now I'm trying to add OpenID authentication to my Rails application.
I've read many tutorials regarding this topic and it seems that eventually I'll get it working.
The problem is that all pieces of information I needed so far and most likely also the ones I will be needing are scattered across the web.
No tutorial had ...
Hi all,
I've recently started using Cucumber & Subdomain-fu together, and it's made me do some terrible things.
I have a step definition that used to look like this:
path = grok_path(path)
get path
That's nice and easy, in my opinion. But now it's this:
path = grok_path(path)
get "http://#{subdomain}.example.com#{path}"
This wor...
Hello all.
Can't figure this one out.
In rails model, I want to call a method within the same model to manipulate data returned by a find method. This 'filter' method will be called from many custom find method within this model, so I want it to be separate. (and I cannot filter from the SQL it is too complicated)
Here is an example:
...
I need to create a simple search but I can't afford to use Sphinx.
Here's what I wrote:
keywords = input.split(/\s+/)
queries = []
keywords.each do |keyword|
queries << sanitize_sql_for_conditions(
"(classifications.species LIKE '%#{keyword}%' OR
classifications.family LIKE '%#{keyword}%' OR
...
I just bought a new MBP
I've read online Sqlite3 already exists on OSX.
I've downloaded mac ports (and installed it) as well as the bin file for sqlite3 from the official web site.
In a guide I'm reading about rails, which tells me to update sqlite3, I run the following in terminal: sudo port upgrade sqlite3
I receive the following ...
My Address class has a geocode class method that returns an array of address objects derived from geocoding the method's parameter (if the geocoding results in an exact match, the array will have one element).
One annoying part about writing this method is translating the GeoKit address objects to my address objects (e.g., "street_addre...
I have a 'name' attribute on a Person model
and every time I access the name attribute, I want name.capitalize to be returned.
Doing the following inside the model won't work,
def name
name.capitalize
end
so what is the alternative?
...
While using Capistrano for deployment every time that I deploy I find that Rails regenerates the entire JS & CSS asset caches. This is regardless of whether or not the file is updated.
Is there any way to get Rails to do this only if one, or more, of the files have been updated?
I have turned off :normalize_asset_timestamps in Capistra...
I have a resource exposed with two actions ONLY ('name' and 'number') and I would like to have a RESTful interface like:
resource/name/1
resource/number/ABC
but with the default
map.resources :controller_name
this doesn't work. How can I add these 2 custom actions? (total n00b here)
Thanks for any feedback!
...
Hi all,
I'm trying to run Heckle, and I keep getting an error:
> spec spec/controllers/my_controller_spec.rb --heckle MyController
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! exception= has a thick skin. There's nothing to heckle.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(R...
I have an AbstractRecord model from which some of the concrete models (which have their own tables) descend. Following is the inheritance.
AbstractRecord < ActiveRecord::Base
Blog < AbstractRecord
Post < AbstractRecord
....
....
In order for Rails to look for the proper tables if there is inheritance, API docs say to define a class me...
I just updated all my gems and I'm finding that I'm getting errors when trying to run Test::Unit tests. I'm getting the error copied below. That comes from creating new, empty Rails project, scaffolding a simple model, and running rake test.
Tried Googling "uninitialized constant" and TestResultFailureSupport. The only thing I found was...