If you use haml as rails view template, you can write portion of your page using markdown by using the ":markdown" filter.
Is is possible to do the same using erb?
I am looking for an alternative to acts_as_solr or thinkingsphinx for fulltext search in my Rails app. Came across searchlogic. Does it support indexing? I am planning to host my app on heroku and I want an alternative because heroku charges for Websolr. I am aware of the alternative way of using texticle or acts_as_tsearch but i want to use searchlogic for its features.
I need to validate form on client-side and I was wondering if there is a rails plugin which will help me in this task (maybe it will build javascript needed to validate certain model)?
I need to install a plugin like this:
script/plugin install git://github.com/apotonick/cells.git
and it just creates a new empty folder in the plugins dir, "cells"
(i use eclipse and rails)
Is that a bad question, i dont get it?(-6 votes)
I know you can do this with virtual attributes, but what if the column actually exists?
For example, my model has a raw_topic column. When raw_topic is set, I want artist and song_title to be set based off of raw_topic's contents. Ideally, I'd like to override the raw_topic= method, but rails doesn't seem to like that.
What's the proper way of doing this? Is a callback the only way?
I am writing a Ruby on Rails app and I want a method to be called every time the database is modified. Is it possible to do this without inserting a method call in every location where the database is modified?
What is the more "rails-like"? If I want to modify a model's property when it's set, should I do this:
def url=(url)
#remove session id
self[:url] = url.split('?s=')[0]
end
or this?
before_save do |record|
#remove session id
record.url = record.url.split('?s=')[0]
end
Is there any benefit for doing it one way or the other? If so, why? If not, which one is generally more common?
I have a rails controller file that is too large (~900 lines - api_controller). I'd like to just split it up like something like this:
api_controller.rb
api_controller_item_admin.rb
api_controller_web.rb
I don't want to split into multiple controllers. What would be the preferred way to do this? Could I just require the new parts at the end? like:
require './api_controller_item_admin'
require './api_controller_web'
Do I need to pay the $30 just to play around in the sandbox for Website Payments Pro? I'm trying to get Active Merchant working in Rails, and it's giving me an error "invalid merchant configuration"... after digging around a bit it says I need to "accept the billing agreement" and/or sign up for the Payments Pro first. So, do I need to pay the $30 just to test in sandbox? Or is there another workaround for this error?
How can I make a helper that will tell me how many weeks ago (rounded down) with rails? It could be based of the time_ago_in_words helper however I'd want it to return: "last week" then afterwards just two weeks ago, three weeks ago, etc...
When I use my regular client and send email through SMTP for an IMAP account, that outbound email gets saved in the IMAP "Sent" box.
How can I have the same behavior when I send email using Ruby on Rails Actionmailer?
For example this query:
SELECT `variants`.* FROM `variants` INNER JOIN `variant_attributes` ON variant_attributes.variant_id = variants.id WHERE (variant_attributes.id IN ('2','5'))
And variant has_many variant_attributes
What I actually want to do is to find which variant has BOTH variant attributes with ID = 2 and 5. Is this possible with MySQL? Bonus Question, is there a quick way to do this with Ruby on Rails, perhaps with SearchLogic?
I have a rails website on www.xyz.com. After I log in to www.xyz.com, if if move to xyz.com, I need to log in again, ie the session is not maintained.
How to make www.xyz.com and xyz.com use the same session.
What is your experience using Ruby on Rails on Heroku in production mode?
Apart of the issue of the expensive https, do you see any drawback in the way it manages processes, memory and storage?
The people at Heroku is quite nice and I'm sure they are willing to answer my questions, but I would like some opinions in the customer side.
Hi All,
I want to know, what is a rails way of converting a subclass record to another subclass record, just changing type isn't working and also superclass to subclass and vice versa.
Thanks in advance
Markiv
I'm trying to prevent users from uploading (accidentally or maliciously) very large files to my website.
I have nginx max_client_body_size set to 4M, but if a file larger than this is uploaded, then it uploads the entire file before returning 413 (entity too large).
I want to make nginx check the Content-Length header, so that it rejects the request before it's uploaded.
Alternatively, a Rails solution would also be acceptable.
Any help appreciated.
I'm creating a digg-like site using Ruby on Rails that ranks the item (based on this algorithm). I'm using the will-paginate gem list the items in pages.
The problem is, will-paginate only allows me to insert ':order =' based on the table data. I would like to make will-paginate to sort by a number which is calculated using a function based on different fields on the table (e.g number of votes, age hours).
How can I do that?
I'm trying out capybara with cucumber to get some better javascript test coverage. I have a lot of steps that check or use things from the Rails integration test helpers, for instance:
assigns(:current_user).should_not be_nil
No matter how I call assigns, even if I say something like p assigns it errors with:
undefined method `template' for nil:NilClass (NoMethodError)
So, it seems that I can't do that anymore. Is there an alternative to introspecting what's going on in the controller, or maybe some way of at least running those steps in such a way that I have the integration test stuff back?
I'm building my first website with rails,it consists of a blog, a few static pages and a photo gallery.
The admin section has namespaced controllers.
I also want to create a mailing list, collecting contact info,
(maybe a spree store in the future too.)
Should I just use basic http authentication and check if the user is admin?
Or is a plugin like authlogic better, then define user roles even though there would only be two; admin and user?
In a Rails application I have a Test::Unit functional test that's failing, but the output on the console isn't telling me much.
How can I view the request, the response, the flash, the session, the variables set, and so on?
Is there something like...
rake test specific_test_file --verbose
Hi,
I have a rails app with authlogic and LDAP, but my problem is i can see all the users password on the log file, is there something to fix to encrypt those passwords.
For ldap i use :encryption simple_TLS
Thanks for your help
I am new to the language and I need to know what are the top things that are absolutely necessary to know in order to make a fully functional website or web app using the Ruby programming language?
Mainly Ruby on Rails with Rake and other tools that mainly use Rake.
Update: I know many other languages like C++, Java, PHP, Perl, etc, etc ....
Update 2: This is great ... keep 'em coming!
I am in the process of creating a Ruby on rails portal
This portal requires a lot of data feeding by the site owner's back-office personnel.
My client has this problem :
the office staff should not be able to access the back office interface from any other than his office computers
I have no idea how to achieve this. Is there a method for this?
Thanks in advance.
I am using the rails helper observe_field to observe a the input of a textfield:
<%= observe_field :word_word, :frequency => 0.25, :function => "wordObserve('#{@word_str}')" %>
When the textfield input becomes a certain value, I would like to stop observing. I have tried both Event.stop() and Event.stopObserving(element, eventName, handler) but neither seem to work. Any ideas?
// using Rails 2.3.5
//routes.rb
map.resources :users,
>> user = User.first
>> helper.link_to user.name, user
I am getting nil error. I thought the above code should work. What am I missing?