Does anyone know of a full featured survey tool for rails? Like Limesurvey (PHP -unfortunately for my purposes.)? Tried to look on Ruby-toolbox, but it seems to be down.
I have a string like this:
"foo=bar&bar=foo&hello=hi"
Does Ruby on Rails provide methods to parse this as if it is a querystring, so I get a hash like this:
{
:foo => "bar",
:bar => "foo",
:hello => "hi"
}
Or must I write it myself?
EDIT
Please note that the string above is not a real querystring from a URL, but rather a string stored in a cookie from Facebook Connect.
I'm new to Rails and feeling my way, but this has me stumped.
I moved some constants to a separate module ie:
module Fns
Fclick = "function() { alert(\"You clicked the map.\");}\n"
...
end
then in my controller added:
require "fns"
class GeomapController < ApplicationController
def index
fstring = Fns::Fclick
...
end
but when I run the server I get:
uninitialized constant Fns::Fclick
what am I missing?
Is there any way in a Rails STI situation to through an error when the base class is Instantiated? Overriding initialize will do it but then that gets trickled down to the subclasses.
Thanks
Hi,
I am trying to move a development environment from production to my local machine (Ubuntu), and when I get the code up and running on my box, the site works in rails but I get this JS error:
Permission denied for http://ad.doubleclick.net to call method Location.toString on http://localhost:3000.
Line 0
Do you have any idea how to fix JS problems, or should I disable the ads in development?
I have a Rails forum product that resides under the subdomains of my customers (i.e. http://forum.customer.com). Their main site has a CMS and an authentication system, and my forum product has a separate authentication system. Is there an elegant way to have "cross-signins" across these systems? I want someone already logged into the main CMS to seamlessly (as possible) transition into my product.
Apache keeps serving up my Rails files with a Content-Type of 'text/plain' in the header. I have mod_mime installed, a mime.types files with all the correct MIME assignments, and the following code in my configuration. Any thoughts?
DefaultType text/plain
<IfModule mime_module>
TypesConfig /etc/apache2/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
I want to run a paperclip method on create only
has_attached_file :file
This method doesn't seem to accept the :on = :create that some other rails methods do.
I tried:
before_create
after_create
etc, but those didn't work.
I also did:
if :create
How can I test if the controller is using the create method from the model?
Thanks!
Hi,
I'm trying to redirect from one controller to another in Rails and I am getting this error:
undefined method `call' for nil:NilClass
The code is pretty simple (in def create method):
@blog_post_comment = BlogPostComment.new(params[:blog_post_comment])
respond_to do |format|
if @blog_post_comment.save
flash[:notice] = 'Comment was successfully created.'
redirect_to(@blog_post_comment.blog_post)
else
render :action => "new"
end
end
Save goes ok, the value gets into the database. How can I work around the redirect fail?
I have a simple Ruby on Rails form which includes an authenticity_token. Unfortunatly, I missed that when you page cache this page then the Authenticity Token becomes invalid. I'm glad I figured it out however.
How do you solve caching in such a case?
Hello I want to create seo optimize url in rails.Same like done in stackoverflow.
Right now this is my url
http://localhost:3000/questions/56
I want to make it something like this:-
http://localhost:3000/questions/56/this-is-my-optimized-url
i am using restful approach.
is there any plug-in available for this.
Is Rails 3 ready to use in Production?
I know is in beta (currently beta 3), but is it suitable to build a simple app using authentication (devise)? Or should I wait for a final version?
What is your opinion?
Thanks
I recently played with MongoDB in Rails using Mongoid. I like the ability to define attributes for models within the model file (as opposed to in migrations):
class Person
include Mongoid::Document
field :name, :type => String
field :birthday, :type => Date
end
For projects that cannot use a schema-less database, does a similar feature exist? Any gems or plugins that generate schemas from a similar syntax would be greatly appreciated.
Thanks.
Hi,
This is a very open question...
I've to build a web service with Rails (with file upload)
What are the key features of a robust/ well designed web service
Thanks for sharing your experience
I am looking for a system to parallelise a large suite of tests in a Ruby on Rails app (using rspec, cucumber) that works using JRuby. Cucumber is actually not too bad, but the full rSpec suite currently takes nearly 20 minutes to run.
The systems I can find (hydra, parallel-test) look like they use forking, which isn't the ideal solution for the JRuby environment.
Configuring the PHP debuggers was so hard that I can't even imagine myself using the Rails documentation by blogging. The problem looks easy to solve: write the documenation, so why doesn't anyone do it?
I'm trying to find the results of a model where it queries as the result of two conditions.
I have a search tag that looks for
Model.find(:all, :conditions => "name LIKE params[search]")
but I'd like for the search to find all records where "name LIKE params[search] or description LIKE params[search] .
Is there any way to add an OR into a condition in rails?
or should I make an if statement?
I'm wondering what the difference is between the following two modules
# First Example
module Parent
module Child
end
end
and
# Second Example
module Parent::Child
end
Using the 2nd method, it appears as though the Parent module must be previously defined, otherwise I get an 'uninitialized constant' error
Given this, what is the preferred way of defining modules such as this and then adding nested children with regards to syntax and file structure (ie. folders etc). Reference to a Rails way would be greatly appreciated.
Are these two examples for all intents and purposes equivalent?
Hi,
I am planning to have something like this for a website that is on Ruby on Rails. User comes and enters a bunch of names in a text field, and a queue gets created from all the names. From there the website keeps asking more details for each one from the queue until the queue finishes.
Is there any queue management gem available in Ruby or I have to just create an array and keep incrementing the index in session variable to emulate a queue behaviour?
I am using aptana radrails
empty rail project :
scaffold Article titre:string body:text categorie_id:integer ordre:integer
Migrate - it works fine
scaffold Categorie titre:string ordre:integer
It generate the files but when i access http://127.0.0.1:3000/categories i have the following error :
NameError in Categories#index
Showing app/views/categories/index.html.erb where line #22 raised:
undefined local variable or method `new_categorie_path' for #
Extracted source (around line #22):
19:
20:
21:
22: <%= link_to 'New categorie', new_categorie_path %
i deleted recreated my whole rails project a few times, changed categorie with another name but it keep failling. Why ?
This might sound odd, but is there a 'Rails way' to have a model destroyed if a certain attribute is blank? Say I have a model like tags with just a name attribute or something, if the user edits the tag and deletes all the text out of the name field in the form I'd like the model to just be deleted.
I'm aware of the reject_if method, but that doesn't seem to work.
I'm using prawn to generate pdfs, set up ala http://wiki.github.com/sandal/prawn/using-prawn-in-rails
I'd like to access my routes so I can generate links in my pdfs, but now I'm not in a template like I used to do with prawnto, so I don't have access to the named routes.
class MyPdf < Prawn::Document
def to_pdf
text root_path
end
end
How can I include my named routes?
I've been trying to get autocomplete to work, however, I am getting a weird javascript error in the firebug console...
I used the https://github.com/crowdint/rails3-jquery-autocomplete gem.
The error I am getting reads: $(e).autocomplete is not a function
Here are the scripts i am including in my html:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/javascripts/autocomplete-rails.js?1294035084" type="text/javascript"></script>
Thanks