ruby-on-rails

How do I create a store catalog with rows and columns on index.html.erb in rails application

I have a store application and want my store items to display in a 3 column catalog. I want the 4th item to move to a new row automatically after the 3rd item is placed on the 3rd column on the first row. All items will be called from the database. How can I acheive displaying my product catalog like thumbnails. At the moment this is wh...

jquery-rails 3 autocomplete highlight. strong tag as text

I'm using jquery Ui autocomplete, with this highlight function http://stackoverflow.com/questions/3053286/how-highlight-words-jquery-ui-autocomplete My problem is that it works. But in the drop-down list the strong tag is not rendered as html but as text. For example when i type Wild I end up with something like this Oscar <strong>Wild<...

PostgreSql + Query Statement having \r in between the attributes !!!

Suppose we have a textarea in which we put example string. Textbox contain : Earth is revolving around the Sun. But at the time of saving, I just pressed a enter key after "the sun". Now the statements in texbox :: Earth is revolving around the Sun Now, in database where enter was pressed the \r is stored. Now i am trying to fetch...

Cucumber: undefined step, although step should be defined

I have created the step: Given /^the feed "([^"]*)" has an item "([^"]*)" published at "([^"]*)"$/ do |feed_name, feed_item_title, published_at| feed = Feed.find_by_name(feed_name) FeedItem.make(:feed => feed, :title => feed_item_title, :published_at => published_at) end And I run the cucumber test with: Scenario: feed items ...

Putting the API under its own domain

I think there is a wide consent that is a good practice to separate your REST API from your main website. The main reason is that you can scale your API and website independently of each other. Additionally, Rails has a lot of middleware that is not required for stateless services (e.g. sessions, cookies, view rendering, etc...). Jeff D...

'Could not find gem' error when specifying a forked version of a gem from Github in my gemfile

I am trying to use this forked version of the searchlogic gem. In my gemfile, I have gem "searchlogic", :git => "http://github.com/railsdog/searchlogic.git" when I do bundle install, I get this error: Could not find gem 'searchlogic (>= 0, runtime)' in http://github.com/railsdog/searchlogic.git (at master). Source does not contain an...

Given a Model, how to loop through all properties?

I want to loop through all the properties of my 'user' model, how can I do this? ...

Paperclip and failed validation - avoid reupload

Hello, I am currently setting up Paperclip for a model with Rails 3. When one of the fields fails validation (title), the user has to upload the file again. This is not very user friendly :/ The recommendation from the Paperclip forum is to move the Paperclip stuff into a related model. My model is very simple with just a few fields, ...

Rails routing for render xml gives 404

I'm facing a problem I don't really understand. This is my controller def index @resources = Resource.all(:limit => 10) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @resources } end end When i try to access the html page, everything works fine, but when i hit the .xml ...

Rails parameters from GET/POST

Hi, I'm fairly new to Rails and am writing a login form. I have used form_tag to pass through the user's submission to the account controller. Now, I don't want the user to be able to enter their login details through a GET request, so how can I check that a certain param is either a GET or POST parameter? Thanks in advance ...

Will_Paginate is it possible to let the user select the # of paginated records?

Hi there, I have a paginated list, and a select box of numbers showing how many pages to display. When the user picks a value I want the screen to refresh with the resized list. View: <%= select_tag :paginate_size, options_for_select([['Display: 5', 5],['Display: 10',10],['Display: 20', 20],['Display: 30', 30],['Display: 50', 50],['...

How to get Capybara to see Javascript in plugin directory when creating plugins?

We're developing a plugin for rails, and I've got Cucumber working with Capybara wonderfully. BUT, when developing, I've been (erroneously, I guess) putting the Javascript files in the parent test application's public/javascript directory. So when Capybara runs, it doesn't find the javascript file. How can we get Cucumber/Capybara to see...

Rails 3 tagging problems, acts_as_taggable_on

I'm using acts_as_taggable_on to add tags to posts, other tagging plugins/gems don't work with rails 3. I can edit/display tags on the post model and the tags controller displays the posts tagged by name i.e /tags/post-tag-name/. The functionality I want is to turn the tags on the posts pages into links to display the other posts with th...

FTPS (TLS/SSL) from Ruby on Rails App

Hi all, I have an FTP server which is running FTPS (TLS/SSL) I need to be able to connect to this using a ruby on rails app. Does anybody know of a method to do this. I have tried the Net:FTP libary but this doesn't appear to support explicit FTPS connections. Thanks Craig ...

Please Help ==> Ruby on Rails -- JavaScript

I have a button on my Ruby on Rails view file. Firstly when the button is clicked an ajax call is made which in response gives a json string. So far I have accomplished this task. I am stuck here: The button also redirects me to another action of the same controller. Now I want to send the json string received by javascript as a parame...

ActiveRecord (Rails 2.3.8) - Update existing, add new record when updating nested attributes

I have a "user" model that "has_one" "membership" (active at a time). For auditing and data integrity reasons, I'd like it so that if the membership changes for a user, the old/current record (if existing) has an inactive/active flag swapped, and a new row is added for the new changed record. If there are no changes to the membership, I'...

I was trying to install sqlite3 interface for ruby in my mac snow leopard 10.6.3. But i got the following error any suggestions ?

for this command i got this error "sudo gem install sqlite3-ruby" Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /Syste...

Does this Rails 3 Controller method make me look fat?

This is a new application, and I have an index method on a Search controller. This also serves as the home page for the application, and I'm trying to decide if I am headed down the wrong path from a design pattern perspective. The method is already 35 lines long. Here is what the method does: 3 lines of setting variables to determine...

JBoss based rails application cant find activerecord-jdbcmysql-adapter

Hi All I have a rails application deployed to jboss as a war packaged using warbler. The application has been working great for a while now. I am looking to change the rails application so that rails, all gems and their dependencies are vendor'd. To that extent I have it working great and can boot the application locally using mongrel...

Rails/Devise - What should I test with devise and rspec ?

Hi, Many programmers use devise as their authentication solution and I would like to get their advice: Devise is already tested, but I want to know if there is something to test by myself (integration/unit/funtionnal tests?) for a standard devise integration with my knowledge (I'm not familiar with shoulda and cucumber, but I know a ...