Hello,
With one of my forms, the ActionController::InvalidAuthenticityToken is occurring after the form is sent to the proper controllers "create" method. The thing is that there actually is a valid authenticity token included and the error only occurs in Firefox. Other browsers work fine.
I tried to skip the verification of the auth t...
I'm struggling with how to model a resource and its availability using the tools, gems or plugins available to us in Rails.
Basically each resource will have a typical availability of 0..24 hours for each day (0,1,2,3,4,5,6) of the week. BUT then there will be exceptions that need to be considered for example a holiday or special event ...
I have two models that are not related (in the db sense) but have some common columns (Name, Email, etc.).
Class Account < ActiveRecord::Base
end
Class LegacyAccount < ActiveRecord::Base
end
For various reasons, I cannot merge these into a single model or do STI. But I would like a simple view that displays all records from both m...
I'm currently working my way through http://www.railstutorial.org/
It uses Rspec along with a TDD approach. I understand that writing lots of tests can help you ward off bugs as your app gets more complex, but I don't understand why you would write tests for simple things like the existence of a page title. It seems that you end up writ...
Pretty trivial question, I'm just looking to find out if anything is baked into ruby or rails to handle this.
...
As a Ruby/Rails dabbler, one of the things that's long bothered me is this constant sense that I've just got gem clutter all over the place. Chalk it up to developer OCD, perhaps, or even my novice status as a Ruby/Rails dev, but not knowing where stuff is used, even if it's used, where it lives in my file system or whether it's part of ...
Delayed::Job's auto-retry feature is great, but there's a job that I want to manually retry now. Is there a method I can call on the job itself like...
Delayed::Job.all[0].perform
or run, or something. I tried a few things, and combed the documentation, but couldn't figure out how to execute a manual retry of a job.
...
I have an object: @object
with tons of boolean fields.
now. according to the HTML spec, if a checkbox isn't checked, the value isn't sent.
Which is a problem... cause I need that information.
How do I get around that? the api for f.check_box suggests fields_for... http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.ht...
I have a class with a date. If the user doesn't change it in the view, Rails saves today's date (the default values in the drop downs). I would like it to be saved as a null value instead. How do I do this?
...
What is the correct way to use the form tag, I am getting a compile error when I include the end. When I take it out it works, should I just manually end the form with HTML? Or is there something wrong with my syntax?
<html>
<head>
<title>
Databse connections
</title>
</head>
<body>
<%= form_tag...
I am trying to connect a Rails app on a Windows machine to SQL Server using activerecord-sqlserver-adapter. I have set up a DSN that works great.
When I try to run a migration (or any database operation), I am informed:
"no such file to load -- odbc"
My database.yaml file has this:
development:
adapter: sqlserver
mode: odbc
dsn...
hi
is it possible to create / update a locale language yaml file from with a rails application ?
If so is would it be automatically pulled into the load path somehow as i dont want to have to restart to pull in the new changes ?
Is this possble and if so how ?? or is there a better way ?
I am using mongodb as a db.
thanks
rick
...
class Date
class <<self
alias_method :broke_ass_today, :today
end
def self.today
Time.zone.now.to_date rescue Date.broke_ass_today
end
end
because I would really hate to replace Date.today with that statement everywhere in our code base...
that and its just much simpler write (and read) date Date.today, because that's...
I'm trying to process a payment for a transaction. Currently I'm redirecting to a paypal url in a controller's method and passing in the variables in the url. Paypal seems to convert this to secure it - https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_flow&SESSION=lUAK-18U7c_uxbs0wYsKTqcO7tDjb9M4O2A0hqd4gsKhEyhlC0xCxFabBL8&disp...
I've got a view which looks like this:
<p><%= stage.end_date.strftime("%A, %d %B %Y")%></p>
Sometimes stage.end_date returns null and that's ok, but Ruby throws a NoMethodError.
I'm quite new to Ruby so I want to know how I should I deal with missing/null varibles in views
Do I need to test for stage.end_date in the view? because t...
In trying to run Rails under Cygwin, the ./script/server command is producing a load error that I can't find a solution for searching on Google. I can reproduce this error in irb as follows:
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'digest/md5'
LoadError: No such process - /usr/lib/ruby/1.8/i386-cygwin/digest...
I recently ran into an odd error that only occurred in production mode.
I was using the paths of glory gem that defines the class Achievement (http://github.com/paulca/paths_of_glory/blob/master/app/models/achievement.rb).
In the base class, level is defined:
def level(level, options = {})
levels << {:level => level, :quota => optio...
I have a TakeAction model that looks like this:
class TakeAction < ActiveRecord::Base
belongs_to :user
has_many :take_action_notes
attr_protected :user_id
end
and a TakeActionNote model that looks like this:
class TakeActionNote < ActiveRecord::Base
belongs_to :take_action
validates_presence_of :note
end
Using CanCan, I...
Say I have a store that sells products that fall under various categories... and each category has associated properties... like a drill bit might have coating, diameter, helix angle, or whatever. The issue is that I'd like the user to be able to edit these properties. If I wasn't interested in having the user change the properties, and ...
I'd like to write a simple function to say in hours :
How much time has passed since this has been created?
My attempts are futile.
-time = DateTime.now.hour - (self.created_at.hour)
Does anyone know how to do this in Ruby on Rails?
...