Hi
I am trying to create a ruby on rails app to capture data from form and create a corresponding XML.I have created a dummy model class which is not extending active record
Do i have to do that .Below is the code and the error i m facing plz help
class RamOne
attr_accessor :name,:city
end
Controller
def start
...
This is mostly of a design pattern question. I have one type of model that I'm going to get the data to create them from multiple sources. So for example one record my be created from an API where another is created via screen scraping with Nokogiri.
My issue lies in how best to abstract out these different data sources. Right now I...
I use TS for full text search in my rails app. I am trying to save the search term to present "most searched" type list in my app. Here is my search controller index action. I notice that with the "save" the search feature the search takes about 1.28s and without it about 1.04s.
Couple of questions.
1- Is there a better way to do this,...
Hi guys, RoR/SQL newbie here.
My datetime column 'deleted_at' are all uninitialized. Running this query returns an error:
SELECT * FROM variants v
ON v.id = ovv0.variant_id INNER JOIN option_values_variants ovv1
ON v.id = ovv1.variant_id INNER JOIN option_values_variants ovv2
ON v.id = ovv2.variant_id INNER JOIN option_values_varia...
script/generate acts_as_taggable_on_migration
rake db:migrate
causes
Mysql::Error: Specified key was too long; max key length is 1000 bytes: CREATE INDEX `index_taggings_on_taggable_id_and_taggable_type_and_context` ON `taggings` (`taggable_id`, `taggable_type`, `context`)
What should I do?
Here is my database encoding:
mysql> S...
Hi:
I am trying to figure out how to redirect a user to the page they logged in from (or failed to login) using Warden/Devise. I figure there is a session variable somewhere that is either available or could be made available.
E.g.
Scenario 1:
Non-authorized user goes to protected page X;
Redirected to login page;
User logs in;
User re...
I have Exam controller.
In routes.rb there is "resources :exams"
In controller there are REST-like generated methods.
I want to add my own method there:
def search
@exams = Exam.where("name like ?", params[:q])
end
In view file:
<%= form_tag(search_path, :method => "post") do %>
<%= label_tag(:q, "Szukaj: ") %>
<%= text_fie...
I have a HABTM relationship between Publications and Categories. In the new and edit views, I have this:
Categories:<br />
<% @categories.each do |c| %>
<%= check_box_tag :category_ids, c.id, @publication.categories.include?(c), :name => 'publication[category_ids]' -%>
<%= "#{c.name}"%>
<% end -%>
The model code:
class Publica...
I am trying to connect facebooker and authlogic using this http://github.com/kalasjocke/authlogic_facebook_connect
I was having problems so began to debug the facebooker gem code. I realized that no params are getting set using the facebook login that have anything to do with facebook. I can push the facebook login button, it brings up ...
What's the best way to parse a css file, and get a list of all the css (using @imports), and the images that are referenced as background-images etc? Is there any parser for css available in ruby??
...
Hi there, the photo display sript is below:
<% if user.image %>
<%= image_tag user.image.url('100x20') %>
<% end %>
How can I only showing the right side of the photo by 20 x 20 on the web. it mean cut off the 80% on the left show only 20% of the whole picture.
Many thanks!
...
Hey everybody,
I am having problems in order to debug an app using ruby-debug with RadRails.
I try to install the gem with gem install ruby-debug19 -as I am using Ruby 1.9.1-p249 but I get the following error:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:>gem install ruby-deb...
I planned on using this module (full exmpample here http://pastie.org/1098444)
puts "Name_and_key was referenced."
module Name_and_key
def normalize(s)
s.mb_chars.normalize(:kd).gsub(/[^\-x00-\x7F]/n, '').to_s
end
def name=(name)
self[:name] = name
self[:key] = normalize(name).downcase
end
def name
self[:na...
How can I get a full url in rails?
url_for @book is returning only a path like /book/1 and not www.domain.com/book/1
Thanks (and sorry if the answer is obvious. Im learning rails!)
...
I'm using rvm (Ruby Version Manager) and running Rails 3 RC. I need to test an app to see if a bug has been resolved with a recent commit to Rails 3 master on GitHub.
How do I install Rails 3 master from GitHub and then generate a new app?
I can't use
gem install rails --pre
because I want the edge version, not the release candidate.
...
I have an app that I've been developing that has so far only been a single user environment. I finally got to the point where I needed to add multi-user capabilities so I followed the railscast on authlogic to get a simple login.
I then added a has_many :items and accepts_nested_attributes_for :items and a belongs_to :user to the corre...
I have a problem using the heroku db:push command to transfer a MySQL database to heroku. I've tried using the same command for another app with a sqlite3 database and everything went fine.
C:\Users\reg\Team-Omni>heroku db:push
Loaded Taps v0.3.9
Auto-detected local database: mysql://127.0.0.1/omni_dev?encoding=utf8
Warning: Data in t...
I'm learning RoR through this tutorial. In tute, an application.html.erb file is created in views/layouts. In the body, a content div is created, and the <%= yield %> line is used. The other views that are created are then just inserted into the content div in the body of the application template.
But there are a few views that I have w...
I have a method defined in my controller that I am trying to create a button or form to access.
Model
class DoThis < ActiveRecord::Base
def take_action(a, b)
end
end
View
<%= @do_this.take_action(@a, @b) %>
I would like to convert the above code in the View to a button_to or form_for but cannot figure out how.
Thanks
...
I am a developer who has stepped into the world of Rails very recently. I have learnt Rails 2.3.8 and have now landed into a major project in rails. The question we are facing is this: "Should we use Rails 3.0 for development or the older version?"
Our project has a time frame of 4 to 6 months for its release. Will Rails 3.0 be out of b...