How can I allow a specific server/url to send for example a post request if I have activated protect_from_forgery in a Ruby on Rails application?
Usually it is a desired behaviour that a Rails application blocks requests from other servers and so I also want to keep this functionality and I do not want to switch protect_from_forgery off....
I recently started a project where the team decided we'd like to use jQuery rather than Prototype/Scriptaculous for our javascript needs. We set our project up, and began the switch. The plugin was installed via these instructions, and all went according to plan. Shortly after, when trying to run "./script/server", we get the followin...
Hi,
I have textmate 1.5.7 running on my leopard machine.
When programming in rails, for some reason some key words do not get highlighted.
For example: validates_presence_of, has_many, remote_form_for (form_for gets highlighted) etc...
I tried switching themes and it did not help. I also tried upgrading to the most recent rails bundle ...
I am a ruby on rails newbie and had a question about the view logic in case of associated objects.
My models look similar to
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
And what I want to display is something like a list of all the posts and the 1st 3 comments f...
i changed my .autotest file to use with ruby based project.
after that when i wanted to use it for rails it is using the .autotest configuration settings i used for ruby project.
i uninstalled autotest and reinstalled it with no luck.
i also removed .autotest file in root directory but it is not working.
...
I want links that when hovered over you see the link to look something like this:
http://www.website.com/redirct_to=linkID2
(maybe not exactly like that but try to get the idea)
I have a form area in my blog that I can input a website url but I want to make it redirect_to an external website when it shows the post.
...
I have two scaffold-generated models: Book and Bookbag. A Bookbag has-many Books, and a Book belongs-to a Bookbag. Each Book has a weight, and each Bookbag has an average-weight that is supposed to store the average weight of all of its Books. What is the best way to keep average-weight up to date?
Using a before-save filter on Bookba...
I am using Sphinx with the Thinking Sphinx plugin to search my data. I am using MySQL.
My data contains accented chars ("á", "é", "ã") and I want them to be equivalent to their non-accented counterparts ("a", "e", "a", for example) when searching and ordering.
I got the search working using a charset table (pastie.org/204316), and a se...
I have a rails model class
class Model < ActiveRecord::Base
has_many :object_collection
def add_object(object)
object_collection.push object // works
@object_collection.push object // does not work
self.object_collection.push object // works
end
end
I was wondering if someone can please explain to me why t...
Let's say I have an image that does not reside in the normal location:
{appname}/public/images/unconventional.gif
But instead here:
{appname}/unconventional.gif
I understand this is a complete violation of Rails conventions, is immoral and you should never do this under any circumstances and, furthermore, why would I even suggest s...
I deployed an rails(2.3.2) app on Passenger 2.2.2.
It crashes sometimes.
There's the error message.
Passenger encountered the following error:
The application spawner server exited unexpectedly: Broken pipe
Exception class:
PhusionPassenger::Railz::ApplicationSpawner::Error
Backtrace:
# File Line Location
0 /dh/passenger/lib/phu...
I have public and private projects in my app. I want to assign user to private projects for viewing and posting. What's the right way to do this? I tried with a permissionlist model and associated it to a project. but i got so confused that i couldn't make it.
...
If I want to match x.gif and y.gif, is it possible to pass a URL to map.connect that encompasses the possibilities of both filenames something like this:
map.connect "public/images/:name.gif",
:controller => "static_image_controller",
:action => "serve"
And then receive the param in my StaticImageController as params[:name]?
clas...
I'm trying to fool a very complex black box into displaying some floats differently (it's the Gruff graphing library, so this is being rendered to an image).
In the console, I can paste this:
logger = RAILS_DEFAULT_LOGGER
logger.debug "Here's a float #{455.67.to_s}"
eval %{class Float
def to_s_with_time
h = (self / 60...
Hi All,
I'm currently managing multiple models from a single SITE MANAGER page. I have the following relationships:
Sites -> Buildings -> Meters -> Values
Beside each "Sites" item I have "Edit | Delete | Add Building"
Beside each "Building" item I have "Edit | Delete | Add Meter"
Beside each "Meter" item I have "Edit | Delete | Add ...
What want to be accomplished is:
I want to "synchronize web browsers". my site has a "wait URL" where when browser gets there it will be kept waiting till another browser also go there and then both will be presented with a quiz-like game.
Right now the wait url will call each second to Rails to check if other player came to the game. H...
OK I'm sure I'm missing something here, but please forgive me I'm new to Rails.
Is there some way in Rails to display all the fields for an object rather than specifying each?
In my show.html template rather than going
<p>Name: <%=h @user.full_name %></p>
<p>Email: <%=h @user.email %></p>
I just want a oneliner to do this without...
Assume we have an usual M-M relationship between two tables, like:
users---< users_tags >--- tags.
In this post I'm only concerned about the relation user_tags, tags: I'd like to avoid that linked tags can be deleted. Only tags which aren't referenced should be destroyable.
The stupid way to do this would be:
class Tag
def before...
I have seen Ryan Bates talk about exception_logger and exception notification. Are there any other good ones to consider? What do you like and dislike about these?
Also, do these exception notifiers log exceptions if you catch them?
Thanks!
...
I get this error trying to run any Ultrasphinx rake commands (under Linux terminal) such as rake ultrasphinx:configure :
rake aborted!
no such file to load -- echoe
/var/www/gitorious/vendor/plugins/ultrasphinx/Rakefile:2:in `require'
/var/www/gitorious/vendor/plugins/ultrasphinx/Rakefile:2
/usr/lib/ruby/1.8/rake.rb:2359:in `load'
/us...