Hi,
How can I send the error messages that are happening in the model code back to the view. I mean. I have a
begin
Some code
rescue
Exception Handling
end
now error occurs and in the rescue, I would like to send a message back to the controller, so that it ll get displayed in the view. Do I have to use a variable, whic...
Hello,
I'm new to rails and building a small test app on rails3 (beta4).
I am using Authlogic to manage user sessions (setup in a standard fashion as per this tutorial)
I have scaffolded and setup a card model (a post basically), and set up the basic active record associations for a belongs_to and has_many relationship
user.rb
has_m...
I want to make a community based site, which is Drupal's strength. However I also want to try other frameworks, especially Rails.
One of the best things about drupal is its huge modules library. If I were to switch to Rails, would I be able to find similar functionality freely available as plugins, or would I have to rebuild?
Does Rail...
how do i display error messages in the web browser when using rails?
eg. if i use a variable in the view that i hasn't defined in the controller i want to get an error message.
thanks
...
I'm in the process of converting my Rails app to use mongodb through mongoid. I have two questions relating to indexes. I think I know the answer, but I want confirmation from someone who has more experience with mongodb.
Let's look at the following example where I have one relational association between Users and Posts.
user.rb
class...
I have the following in my routes.rb
map.diff 'posts/:id/diff/:from/:to', :controller => "posts",
:action => "diff", :conditions => { :method => :get }
And I have the following in my view file.
- form_tag(diff_path(), :method => :get) do
= text_field_tag(:from, "")
= text_field_tag(:to, "")
= hidden_field_tag...
Trying to start a new Rails 3 beta 4 app with mysql.... Running OS X Snow Leopard. WIth previous versions of Rails I have no problem with MySQL. But now when I start the Rails 3 app I get the following error when I click "About Your Application Environment" on the Rails index.html startup screen:
undefined method `init' for Mysql:Class
...
Here is the scenario, i would like the user to input all the data and all and use em to populate a result. I won't need to store them in a database since i will just be showing them a result page.
I did http://railscasts.com/episodes/219-active-model and made my model tableless.
But now i have a problem when i wanna receive image uploa...
I've put this line in my routes.db file:
map.mything '/mything', :controller => 'mything', :action => 'list'
But I get this error when I go to http://localhost:3000/mything, I get this error:
Unknown action
No action responded to index. Actions: list
Why is it trying to use index instead of list? I thought that by setting
:action ...
I've got this line in my routes.db file:
map.resources :things
I'm trying to create a link that will create a new thing. So far I've got
<%= link_to "add thing", things_path (:thingName => key)%>
But I'm getting this error message:
Unknown action
No action responded to index. Actions: create and new
How do I do the link_to line ...
Hello,
I'm trying to 'manage' users, instead of 'new' and 'show' users via actions. The problem is somewhere in routes I suspect, as my link '/users/manage' is being received as an id parameter to 'show' action:
Terminal log of process:
Processing UsersController#show (for 127.0.0.1 at 2010-06-28 00:31:45) [GET]
Parameters: {"id"=>...
"Attempt to call private method" with depot tutorial
In my "cart.rb" model I have
def add_product(product_id)
current_item = line_items.where(:product_id => product_id).first
if current_item
current_item.quantity += 1
else
current_item = LineItem.new(:product_id=>product_id)
line_items << current_item
end
curre...
Hi,
I am kind of new to Rails and I want to write some self.down queries. Currently I am hardcoding the entire query. Is there a easier way to do it ?
def self.down
delete("delete from trigger_events where name = 'CHANGE_APPROVED'")
delete("delete from notifications where trigger_event_id = 5")
delete("delete from notific...
Hi,
I am recording audio on the iPhone to a CAF file with kAudioFormatiLBC, the recording works fine.
I want to be able to take a sample and also get it to convert to other formats after I have uploaded it to by ruby on rails webservice.
I am trying to use sox but get:
sox in.caf out.mp3
sox FAIL formats: can't open input file `in....
Brand spanking new to Regex in Rails so please be gentle... I found the following on Regexlib.com to validate no spaces.
^[a-zA-Z]+$
But when I put it into
validates_format_of :first_name, :with => ^[a-zA-Z]+$
I get an error saying unexpected tCARET. What's the problem?
...
Hi...
While trying to add an error message using add_to_base, I am getting an undefined method 'errors' message. I am defining it in my model. Am I supposed to include any other file in order to access the errors variable.
Model File - I am defining it inside a method
self.errors.add_to_base("Invalid Name")
Error Message
undefined ...
We're working on some Ruby on Rails web application which is currently in English but should be translated to more languages. We deploy new version of application to production every 2 weeks. Translators are a separate team.
We have a special page in admin area for making translations. Dictionaries are stored as YAML-files. We can let ...
Hi,
Is there any way I can make my rails model validations execute in a particular order and skip certain validations if previous validations are not satisfied.
For eg: I have 2 input fields start_date and end_date. I have two validate methods in my model
One of them checks the dates are less than "12/31/#{Date.today.year + 1}"
def ...
Hi,
I want to be able to read the referrer of visitors coming from certain domains when they come to any subpage of a rails app.
How would I handle that before the controllers come into play ? (I want a general solution for alle pages, not to check it on every single controller)
Any hints appreciated.
...
I would like to connect to those applications which provided OAuth API (such as fb, twitter).
Is there a relatively easier way to integrate those APIs?
I have successfully used linkedin gem which can connect to LinkedIn OAuth API. But I really don't want to install a gem for dealing with a single application, where those applications p...