I'm adding a new column, summary, to an existing table. It will contain a plaintext snippet of the HTML from the column body.
I want to create summaries for all existing emails when I run my migration. However, I can't figure out how to use strip_tags within my migration.
Here's what I have so far:
class AddSummaryToEmails < ActiveRec...
I want to extract a user country name from visitors' IP addresses.
I could get the IP address with remote_ip. But what could be
the easiest way to get the country name?
It doesn't have to be super accurate. Any ruby library (gem or plugin) to do this?
I want an simple and easy solution for this.
...
In this movie http://media.railscasts.com/videos/181_include_vs_joins.mov you can see he is using a custom ./script/console and all find results are shown nicely like this
Is there a plugin for that?
...
I have the following route
map.resource :account, :controller => "users"
map.resources :users
and /account/new points to /users/new just fine.
However, if I add a new page, payment.html.erb, in /app/views/user, restart the server, and visit /account/payment, I get
No route matches "/account/payment" with {:method=>:get}
/users/pay...
So I'm using Thoughtbot's Paperclip on Rails, but ran into a problem where all image attributes are null:
[4;35;1mProject Create (0.0ms)[0m [0mINSERT INTO `projects` (`name`, `start_date`, `status`, `image_file_size`, `updated_at`, `url`, `image_content_type`, `description`, `progress`, `image_updated_at`, `created_at`, `image_file_na...
How can I cache my REST controller with Rails where my actions have query string parameters?
Example: GET /products/all.xml?max_price=200
Thx!
...
I have a private message model that relates to two users, how do I setup an association so that PM.sender is the sender's user model and PM.receiver is recipient's user model? (so that I can call PM.sender.username etc.)
I have a sender_id and receiver_id field.
...
I saw alot of good tagging plugins but are these plugins really what I want?
I want to:
- Tag products, users and news
- Search by tags
- List all tags like SELECT DISTINCT tag (for a autocomplete tag list and button tags like here on stackoverflow).
I'm thinking of a separated model Tag. What is the best way to do it?
...
I love jQuery but am running into a problem with larger site and multiple pages. My problem is that each page has unique requirements and I need to know the best way to tell jQuery which pages to activate certain things. For example, some forms need the Validator plug-in and some don't, some tables use DataTables plug-in and some don't...
UPDATE: Ok, I am a retard & feel free to give me negative votes because the issue was that I had named the file _stylesheet.html.erb & not _stylesheets.html.erb. I thought I checked spellings but clearly I did not. I apologize for wasting everyone's time and I appreciate your input.
Hi,
I am learning rails and I started with Ruby on Ra...
I just installed acts_as_taggable_on plugin and I'm trying to do
@products = Product.find(:all, :include => [:points, :tags], :conditions => '...', :tags => 'tag1, tag2')
As you can see I would like to use find() method with 2 other models (Product,Point,Tag). I would like to use all 3 models in a :condition => {} attribute.
Is it pos...
I installed act_as_ferret plugin according to this tutorial http://opensoul.org/2008/4/29/using-shared-indexes-with-acts_as_ferret. However I'm not seeing any results.
When I dug further, here is what I see in my act_as_ferret log file
link text
I'm guessing for some reason its not indexing properly. I deleted my index file couple time...
Hi,
The only US weather data that is available free for commercial use is the US National Weather Service. I'd like to use it. Is there a Ruby/Rails library for accessing it?
Perl would also be helpful. They provide a Perl example. I'd use it as a guide for writing the Ruby version.
...
If I implement RESTful routing for a controller 'galleries' like as follows:
map.resources :galleries
By default the show url for this controller would be:
/galleries/:id
which would respond to any requests to /galleries/1 etc.
What if I had a gallery record in the database with a 'name' attribute with value 'portraits'.
Could I...
Hi there, this is my first time posting here, looks like a great site! I'm struggling with a has_many association. I have a diary application. The Model players are as follows:
User
UserFriend
UserFoodProfile
I want to be able to get at all the foods that a user's friends have eaten. So, I want to be able to get: current_user.fri...
I followed the tutorial here http://yardoc.org/docs/mmangino-facebooker/Facebooker/User#publish_story-instance_method
using
@user.publish_to(@user, :message => 'hello world')
Where @user is an instance of Facebooker::User.
This method call causes the application to error out. Any help?
...
I have a name route:
map.up_vote 'up_vote', :controller => 'rep', :action => 'up_vote
But up_vote requires two arguments to be passed in, postID and posterID and I can't seem to figure how to do that in a partial, but in an integration test I have no issues.
Partial:
link_to 'Up Vote', up_vote_path, {:postID => session[:user_post_i...
Right now I'm using a has_and_belongs_to_many association for two of my models like so:
class Books < ActiveRecord::Base
has_and_belongs_to_many :publishers
end
class Publisher < ActiveRecord::Base
belongs_to :publishing_company
has_and_belongs_to_many :books
end
You'll notice that each publisher belongs to a publishing c...
I've installed FaceboxRender and JQuery and Facebox. Following the instrutions on http://github.com/ihower/facebox_render/
I've tried Facebox alone, in my rails app and it's working.
After that I've put the folder facebox_render in vendor/plugins/facebox_render/, I added
include FaceboxRender
in /app/controllers/application.rb
restar...
Hello,
I have an already working website and I need a coming soon page for everyone but the admin users. So I would like to have a way for admins to authenticate when they go to /login and use the website if they provide the right credentials and if not, just display the coming soon page.
Thanks,
Cezar
...