I'm making a simplistic message board with tags. The message#index view displays a list of all messages. The tag#show view shows messages of a specified tag. On the message#index view, there is a form (partial) that requires the user to write a message and to tag it. On the tag#show view, I'd like to use the same form partial but to have...
We want to grant automatic access to premium content (that is ordinarily password protected) to student client requests coming via their university's proxy server.
Any ideas on how to go about this for a ruby on rails app?
...
Hi,
I am working on a ruby on rails application. For a session controller, I want to use a case to check if a user's account is locked or banned. I am trying to use the object of a class as the case, and use when to check attributes.
For example,
user = Profile.find(1)
case user
when user.ban
redirect_to()
when user.lock
redirect_...
I have a view that takes a Ruby Date, performs some formatting on it to output just the time in the format [5:30 PM]. Then by default it adds 30 minutes to that so the result is similar to the following output:
5:30 PM - 6:00 PM
and the code in the haml file looks like:
=format_time( @time ) + " - " + format_time( Time.parse( @time )....
I see in the config/initializers/devise.rb, there is a configuration called "config.stretches".
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
config.stretches = 10
I d...
Hi all,
I followed a few rails tutorials online, and it seems that to capture a date, I'd use date_select helper. But for some reason or another all the other data is captured in the database (SQLite3) except for the birthday. Any idea what I'm doing wrong?
Here's the code for the form in my view:
<% form_for :user, :url => {:contr...
In my app, I've got a little box that appears on every page, checking on the status of requests made by the user. If a request is accepted at any time, then the user should automatically be taken to a certain page. This is my code so far:
<% offersMade.each do |w| %>
<% if w.accepted == true %>
<% redirect_to offer_path(:email => ...
I want to create a admin section for my website that is separate from the normal application which is accessible from /admin/controller
I tried creating a scaffold for it using :
$ruby script/generate scaffold admin::scheme
But when I go to /admin/schemes I get this error :
ActiveRecord::StatementInvalid in Admin/schemesController#n...
Hi..I am getting the following error while trying to add a NOT NULL column to an existing table. Why is it happening ?. I tried rake db:reset thinking that the existing records are the problem, but even after resetting the DB, the problem persists. Can you please help me figure this out. Thanks
Migration File
class AddDivisionIdToProfi...
Is there any major difference between load and require in the Ruby on Rails applications? Or do they both have the same functionality?
...
It's not a blog post, it's a question!
Speaking about types I mean that we have type value and type description. We can have different types (gender, size, color and etc) and a collection of values for each type.
We have 2 choices: to keep types in database or in application.
For me to keep the whole table to store type values for each ...
I am using tabs and want to load multiple index pages into tabs. For instance:
class AnimalsController < ApplicationController
def index
@dogs = Dog.all
@cats = Cat.all
end
end
Then in my views/animals/index.html.erb
<ul class="tabs">
<li>Dogs</li>
<li>Cats</li>
</ul>
<div id="#dogs">
<%= render @dogs %>
</div>
<div...
I just started using bundler with rails 2.3.8. After running bundler install there is folder .bundle at the root of my project.
Should I put .bundle under version control?
...
In my project i have this combo box, and it works perfectly:
<%= collection_select @project, @project.clients.id, @project.clients, :id, :name %>
My simple and quick question is, how can i render this in a partial, I'm using this and it's not working...
<%= render :partial => "clients", :collection => @project.clients, :locals => {:p...
i heard rails 3 almost ready to be released from beta, mean stable version. but of course the real date still unknow.
so i wanna ask ror rock developer. do u think me should learn and use rails 3 RC ver. or use rails 2.3.8???
if i now use RC version will it be hard to upgrade to stable rails 3 version?
can anyone rock developer guide m...
I have a server which is polling for mentions from Twitter. It works great in my test environment, but in production it started to fail after a while.
I use the twitter_oauth gem 0.4.0. I cant see whats different in production.
client = TwitterOAuth::Client.new(
:consumer_key => 'k7P---------gTQ',
:consumer_secret => 'PDWa--------...
In my rails app, I need to submit a form via ajax so that the form submit happens behind the scenes and doesn't require a full page reload.
I did form_remote_tag, but I can't figure out how to get a response from it make sure it was successful. Is there a way to, or do people just trust it's always successful (eek!)?
Or is there a bett...
OK I am pulling my hair after trying this out too many times to debug.
So pls pls help me out here
I keep getting 401 Unauthorized error after I am redirected back.
Here is my code
What am I doing wrong here?
require 'rubygems'
require 'OAuth'
require 'json'
class SessionController < ApplicationController
before_filter :load_o...
Im trying to use this jquery ui widget for autocompleting a textbox in my app.
I have created an index.json.erb file inside my views/university folder
here's my current (piece of crap) code
json='['
<% @universities.each do |u| %>
json+='{ "id": "#{@u.name}" , "label":"#{@u.name}" , "value": "#{@u.name}"},'
<% end %>
json+=']'
json
N...
Im trying to figure out the best way to map simple routes into one url. Application contains of 4 models: Location, Category, Budget, Company. But each model could be mapped to single url like this. For real-world example you can check out http://sortfolio.com/
/chicago <- Location
/3k-5k <- Budget
/bars <- Category
/company-name <- Com...