Hi,
I'm accessing the Amazon AWS API using the ruby-aaws gem, but without going to much into details of the API or the gem, I think my problem is more of a general nature.
When I query the API I will end up with "object array", let's call it item, containing the API response.
I can easily access the data in the array, e.g. puts item.it...
My environment:
Mac OSX 10.6 Snow Leopard
Ruby 1.9.2p0
Rails 3.0.0
thinking-sphinx (2.0.0.rc1)
Sphinx 0.9.9-release (r2117)
So far I haven't really been able to get anything to work.
pma:log pma$ rake thinking_sphinx:index
(in /Users/pma/Sites/urban-ent)
DEPRECATION WARNING: Rake tasks in /Users/pma/Sites/urban-ent/vendor/plugins/yam...
I am trying to deploy an app on Heroku, however the app crashes and I get this when I run heroku logs (full trace below; Gemfile content below).
You have already activated rack 1.2.1, but your Gemfile requires rack 1.0.1
I am using bundler (1.0.0.rc.6) for the gem management.
I also have a Scrapi problem, it requires a Mac lib even th...
I have a url like
http://localhost:3000/admin/users
i getting admin/users this by using controller.controller_path
Now i want to convert this admin/users in admin_users
Finally i have change to rails path using
eval "admin_users_path"
Problem: Sometimes admin path not come. I want to made dynamic path for that.
means it can conv...
I have models:
class User < ActiveRecord::Base
has_many :user_skills
end
class UserSkill < ActiveRecord::Base
belongs_to :user
named_scope :rated, :conditions => "count_raters > 0"
end
I want to get count of rated skills.
current_user.user_skills.rated.cont
It works fine, but the generated SQL is a very strange.
SELECT...
how to do? there is an active record option?
...
Hi guys
I have a cms system for multiple clients.
Now i have the following controller:
websites with 2 methods:
index and public.
I would like to serve different types of content through that method.
So it could be images, js, css etc.
But how to accomplish this!
of course i have this extention.. for example /index.css
i check i...
I'm having a bit of trouble understanding the implementation of MVC in Ruby on Rails. Am I supposed to put the bulk of my code in the models, using the controllers to link them to the views? Do I use redirect_to to move between different controllers when necessary?
...
I have 2 models - User and Activity - which are related by a has_many :through using the UserActivity model. A User can either "want" or "done" an activity, which creates a UserActivity record and sets the appropriate boolean.
What would you recommend for handling these actions when creating routes and controller actions? Would somethin...
In my rails2 app users can upload a sql-dump of a legacy_database
(used some funky VBA-macro to dump a MSSQL-db to a text-file)
My problem is: I want to create a new sqlite3 database for each user so I can parse the sql-dump and put it in a empty database. (alongside my main mysql database)
Then the users can select the data they want ...
Hi All,
How can i restrict '♥♣' like characters from saving into database. If these characters appear in name text field, a error message should be thrown.
I am using ruby on rails.
Thanks,
Anubhaw
...
Here's what I'm thinking:
class Widget < ActiveRecord::Base
has_one :widget_layout
end
class WidgetLayout < ActiveRecord::Base
belongs_to :widget
belongs_to :layoutable, :polymorphic => true
end
class InformationalLayout < WidgetLayout
has_one :widget_layout, :as => :layoutable
end
class OneWayCommunicationLayout < WidgetLayo...
I'm writing a Rails app that does a lot of calculations on imported pay-per-click advertising data. The imported logs, which contain records about impressions, clicks, conversions, etc. are all stored in one massive log table, which then needs to be joined with a conversions table to calculate cost per conversion, conversion rate for eac...
I'm having a form in a .erb file, where the user can enter some info. Then I want to make a POST to a different URL (let's say www.3rdparty.com/api.php?f=add_entry), that will reply with 0 or 1, for success or failure. Which is the right way to go, especially if I want to stay on the page with the form, and then show a dialog according t...
I have a dilemma.
My web application deals with subjects like people, places, assets (e.g. images), tags, etc for which I am using RESTful routes generated by map.resources in my routes.rb.
Visitors can set various options for viewing this data, e.g sort order, selection my asset type, owner, or associated tags, and type of view. Thes...
I want to implement a like-counter on an object. Everytime the 'I like' Button gets clicked I want to update the database-field of the object.
In the controllers show-view I placed following form:
<% form_for(@book) do |f| %>
<p>
<% @book.update_like(@book)%>
<%= f.submit "I like" %>
</p>
<% end %>
The update_like method is cal...
I have two rails applications. In the first application
i have the following method in my controller:
def delivery_status
envelope_id = params[:id]
render :json => envelope.to_json(:include => [:deliveries, :log_lines])
end
which, if go to the url in my browser, nicely shows my the JSON. Seems ok.
However, if i call this through j...
I have such lines in Gemfile:
group :test do
...
gem 'cucumber', :git => "git://github.com/aslakhellesoy/cucumber.git"
...
end
When I try do deploy on server via bundle install --deployment --quiet --without development test, I get an error:
sh: git: command not found
** An error has occurred in git when running `git clone "g...
Rails 3 includes the validates_associated which is automatically called when saving a nested model. The problem with the method is the message is terrible - "Model(s) is invalid"
There have been a few posts attacking this issue for Rails 2:
http://rpheath.com/posts/412-a-better-validates-associated
http://pivotallabs.com/users/nick/b...
We're hosting our Ruby on Rails application with the EngineYard App Cloud, which has worked really well for us. They provide a series of deploy call backs (before_restart, after_restart, etc.) which are analogous to Capistrano's callbacks.
We have a series of Rake tasks within our application which maintain various parts of the applica...