I am building a group blog that is moderated by the community. When a user visits the moderate page, he is served up a random post that he has not yet moderated, and asked whether or not the post should appear.
So, the relevant objects are Post, User, and Moderation. A Moderation has a post_id and a user_id. I want to find a post fro...
Hey,
What ever happend to Rails.configuration.gems in Rails 3? I guess it has to do with Bundler. But how can I find all gems now?
Thanks
...
hi,
I'm trying to create a tabbed navigation interface of a user's friends on Facebook. I want each tab to display the name of the friend, with a link defined by me. I'm using RoR's Facebooker. My first try was:
<%= fb_tab_item fb_name(123), some_link %>
Unfortunately Facebook renders the name tag as an escaped sequence:
<fb:tab-ite...
I love new Rail 3!
The new query syntax is so awesome:
users = User.where(:name => 'Bob', :last_name => 'Brown')
But when we need to do something like
SELECT * FROM Users WHERE Age >= const AND Money > const2
We have to use
users = User.where('Age >= ? and money > ?', const, const2)
Which is not very cool. The following query...
I'm using this command:
rails generate model DayOfMonth day:integer
Rails generated the model "DayOfMonth" and the table "day_of_months".
I want it to create the table "days_of_month" instead.
I know this has something to do with the Inflector class and the inflector.rb in initializers folder.
But I don't understand how to get this...
I have a model book with a one to many relation with authors.
I want to add an attribute to a book instance called last_author that puts the latest author and can be implemented as
def last_author
self.authors.last.name
end
but when i do Book.find(1).inspect i cant see the field last_author, but i want it. how can achieve that witho...
Hi All, new to Ruby so I'm still getting to grips with some of the Rails framework and how it relates. I've got a question about why my project behaves in a certain way.
I've created a basic layout, header the top of screen, side menu on the left, and a contents page for the main area. Nothing flash, bog standard as you can see from th...
I'm using Rails and it does not provide support for database specific actions like triggers, stored procedures and various constraints (not all of them).
I wonder if I should put the database logic in the application itself instead.
Because then you can make more complex logic than the database provides and it is also database independ...
Have SubscriberList
When an order is placed I want to check if New User's email is all ready in our subscribers list.
If not, then add them. Problem is it adds them no matter what. Guess it's not performing check correctly.
Currently in my orders_controller I have
unless logged_in?
@order.subscribe_after_purchase(@order.user.emai...
Hi
I have a simple application with a customer and appointment models, system admin can create customer and create appointments for that particular customer, is there a Rails plugin that handles scheduling to ensure no two appointments overlap each other? i.e no two appointments at the same time.
A plus would be if I can set up more th...
Does anyone know a markdown parser in Javascript ?
PS : Actually, I do this with request to server to parse it, but a client side parser would be better :) .
Edit : If there is no one, I will use HTML (with WYSIWYG editor).
...
It's getting old rewriting report code for Rails applications. Ya have to create the query, the routes, the action, and the view...(yes, I'm lazy) Is there anything out there that would create a full report in even fewer steps?
Here's what I imagine would be ideal:
You have a Report record that has a name, query code (in Ruby or SQL),...
I'm using Authlogic as the login system. Everything is working correctly except that it never updates the failed_login_count field when I purposely type in the wrong password. I am using the email as the login item. In the database there is no 'login' column. Is there something that I need to change or add to make this feature work?
...
Last part of my project, Hopefully.
Need to check if user.email attribute changes. If it does, then need to tell mailchimp to change or add the email.
Looks like Dirty will do this, but have never used it before. How can I catch the change in a block, or pass it to a block, and then update the attribute?
...
I am on rails 2.3.5 and ruby on 1.8.7. I have a single application using a local memcached (latest version from apt-get memcached) instance. It seems memcached is working as expected but going through the docs and other comments,
1 - It seems memcached-client is recommeneded for speeding things up. I can't tell for sure with my version...
Using 2.3.8 of rails.
In the view template I have this type of code
<%content_for :sidebar do %>
<h2>Sidebar</h2>
<p><%=link_to "somewhere", "http://www.google.com/"%></p>
<% end %>
<h1>Pictures#new</h1>
<p>Find me in app/views/pictures/new.html.erb</p>
In the application.html.erb template I have
<!-- END: Header -->
<...
What's the best way to redirect all your pages from www to root domain using ruby on rails?
...
I generated movie model, and a movies folder to Controllers.
I deleted index.html in public_html folder, because I want start the movie page, so I edited the routers.rb file with 2 new line:
map.resources :movies
map.index '/', :controller=>"movies", :action=>"index"
I start the application, but something wrong. The error message...
I have a section in my main layout like the following. I am starting to use memcached and wondering if this portion can be cached somehow becasue the current_user call makes a hit to the database for every page load and by nature of the plugin (authlogic) thats behind it, it actually updates the user record (i.e. the perishable token).
...