[Rails] Re: how to do form parameter naming from the form tag?

2012-08-13 Thread Tim Shaffer
You can use the as option on your form_for tag: form_for(@person) will generate inputs like person[name] form_for(@person, :as = something[person]) will generate an input like something[session][email] -- You received this message because you are subscribed to the Google Groups Ruby on

[Rails] Re: how to do form parameter naming from the form tag?

2012-08-13 Thread Tim Shaffer
Sorry, should have been something[person][name] instead of something[session][email] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this

[Rails] Re: button_to with image

2012-08-10 Thread Tim Shaffer
If the button is to submit a form, you can use image_tag_submit http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-image_submit_tag Otherwise, you can just use link_to(image_tag(...)) -- You received this message because you are subscribed to the Google Groups

[Rails] Re: Server is not starting

2012-06-19 Thread Tim Shaffer
Check what the error message is telling you. You need to install a JavaScript runtime. Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes -- You received this message because you are subscribed to the Google Groups Ruby on Rails:

[Rails] Re: Associations join

2012-06-19 Thread Tim Shaffer
Check out the guide to associations. It should have more information than you need... http://guides.rubyonrails.org/association_basics.html -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: issues with text_field in rails

2012-05-08 Thread Tim Shaffer
It's case sensitive. Are you sure you don't mean name instead of Name? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/mqTCBUktDAQJ. To post to

[Rails] Re: SQLite3 to Postgre Problem

2012-05-01 Thread Tim Shaffer
The error message is telling you the problem: relation appointments does not exist Can you post the contents of your CreateAppointments migration file? I'm assuming this is where the appointments table should be created. -- You received this message because you are subscribed to the

[Rails] Re: undef keyword with symbol

2012-04-30 Thread Tim Shaffer
id and class are built-in ruby methods that are present on all object instances. Rails uses them in a different manner than the default Ruby implementation. They are undefined so that they can be picked up by the method_missingmethod. -- You received this message because you are subscribed to

[Rails] Re: What naming conventions do you use when writing i18n yaml files?

2012-04-27 Thread Tim Shaffer
For your first example, Rails already has built-in keys for submit buttons that you can change globally: en: helpers: submit: create: Create %{model} update: Update %{model} Or only for a specific model: en: helpers: submit: post: create: Create the new

[Rails] Re: How to implement File Uploading

2012-04-20 Thread Tim Shaffer
Just curious why you want to do this without using any database or models or gems? At any rate, check out this tutorial below. It uses a model, but you can copy the code from the DataFile class to accomplish what you are trying to do.

[Rails] Re: value pass from controller to view

2012-04-17 Thread Tim Shaffer
Your folder structure does not seem right. You should not have a home folder. You should have a users folder with a home.html.erb On Tuesday, April 17, 2012 10:06:30 AM UTC-4, amvis wrote: i have one controller *class UsersController ApplicationController* * * * def home* *

[Rails] Re: Rails 3.2 with many stylesheet assets in dev mode = error with IE HTC-behaviours

2012-04-13 Thread Tim Shaffer
Set config.assets.debug = false in config/development.rb -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/WDMIcYMtBJUJ. To post to this group, send

[Rails] Re: one master table to hold symbols: good or bad idea?

2012-04-03 Thread Tim Shaffer
What problem are you trying to solve by doing this? Just seems like it would make your code more complicated with no real benefit. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] I18n.t('countries.NO') broken?

2012-04-01 Thread Tim Shaffer
no is a reserved word. You will need to enclose it in quotes. NO: Nope -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/JsFPHGqMHHQJ. To post to

[Rails] Re: controller missing - locale

2012-03-30 Thread Tim Shaffer
Can you paste the exact error that you are getting? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KQzCf8AuYtoJ. To post to this group, send

[Rails] Re: Help Converting from SQL to Rails syntax

2012-03-30 Thread Tim Shaffer
I am a little confused here. If ModelB belongs to ModelA, I think your foreign key relationship is backwards. The model_b_table should have a foreign key to model_a_id, not the other way around. Regardless, though, you can pass conditions to delete_all which should help you accomplish what you

[Rails] Re: why doesn't .where() honor polymorphism?

2012-03-28 Thread Tim Shaffer
When you write belongs_to :parent Rails expects there to be a class called Parent. If you want this to be related to the MyModel class, you'll need to explicitly state that: belongs_to :parent, :class_name = 'MyModel' -- You received this message because you are subscribed to the Google

[Rails] Re: Sharing session variables across Controllers?

2012-03-08 Thread Tim Shaffer
Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are

[Rails] Re: account controller, can I use 2 layouts within the same controller?

2012-03-07 Thread Tim Shaffer
You can specify a layout that applies only to specific actions in a controller: layout whatever, :only = [ :some_action ] Check out the guide on layouts for more options: http://guides.rubyonrails.org/layouts_and_rendering.html -- You received this message because you are subscribed to the

[Rails] Re: redirect_to flash

2012-03-07 Thread Tim Shaffer
I believe those two are just the most common. Look at the rest of the code, though. It looks like you can specify other flash values like so: redirect_to suppliers_path, :flash = { :success = 'Supplier was successfully created.' } -- You received this message because you are subscribed to

[Rails] Re: Twitter like route

2012-03-06 Thread Tim Shaffer
Your constraint is slightly wrong. Unless you are settings request.session[:token] somewhere else in your code, chances are it's going to be nil. What you most likely want to check for is request.params[:token] which will match the token in the URL. You also have it backwards. The constraint

Re: [Rails] string differences between ruby 1.8 1.9.3

2012-03-06 Thread Tim Shaffer
For the simple reason that single quotes in Ruby do not allow for string interpolation (such as \r and \n), while double quotes do. On Tuesday, March 6, 2012 2:33:23 PM UTC-5, Craig White wrote: .join(\r\n) did the trick. Needed to use double quotes and not single quotes (don't understand

[Rails] Re: how to use link_to with :remote=true in rails 3.2.1

2012-02-29 Thread Tim Shaffer
You probably want to use $(#allclick).update instead of $(allclick).update Note the # that indicates you are selecting an element by the ID. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Collect users who posted items with ActsasTaggable on Tag in rails 3

2012-02-22 Thread Tim Shaffer
How do your Article and Blog models relate to the User model? Assuming User has many Articles and Blogs you can simply do this: user = User.find_by_whatever(something) user.articles.tagged_with(tagname) user.blogs.tagged_with(tagname) -- You received this message because you are subscribed to

[Rails] Re: link_to param body

2012-02-21 Thread Tim Shaffer
Well you have at least two options to hide the parameters: You could change your link_to call and include :method=:post so it does actually send a post request. This doesn't really hide the parameters since the user can still view the source of the page and look at them. You could send them as

[Rails] Re: Conditional Logic on link_to with a block.

2012-02-21 Thread Tim Shaffer
Maybe just put the logic in the controller? if @brand.nil? if @store.nil? @brand_link_path = from_catalog_path(params[:id].blank? ? Category.root.id : params[:id], product.id, product.name_url) else @brand_link_path = from_store_path(@store.id, product.id) end else

[Rails] Re: Polymorphic associations with ownership

2012-02-03 Thread Tim Shaffer
Sounds like you could just add a belongs_to :user to the Comment class. But since you already have comments on the user, you'll need to give the reverse association another name. Perhaps comments_owned So add has_many :comments_owned, :class_name = Comment to User. -- You received this

[Rails] Re: after_save in plugin

2012-01-30 Thread Tim Shaffer
I think your issue may be a mixup with class instance and instance variables. However, what's the issue you are having with all this? Are you getting any error messages? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this

[Rails] Re: Using search_field as select

2012-01-30 Thread Tim Shaffer
What exactly are you trying to do? All that search_field does is create a HTML input with type=search If you want a dropdown you should use collection_select or something similar -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view

[Rails] Re: Interesting strangeness with I18n.t

2012-01-30 Thread Tim Shaffer
Pretty sure that YES and NO are reserved words. Try putting the definition in quotes: NO: Norway -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Skipping the First Line when reading in a text file

2012-01-26 Thread Tim Shaffer
This is by no means a RoR question. But the solution is pretty simple, so I'll give in. One way to do it would be to just put next if line.lineno == 1 at the beginning of the loop. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view

[Rails] Re: redirect_to :back - Any way to go back two pages?

2012-01-25 Thread Tim Shaffer
If you can do it in JavaScript, you can always just do window.history.go(-2) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/84XQPpvPqsEJ. To post

[Rails] Re: How to encode (.) Dot in url Rails

2012-01-20 Thread Tim Shaffer
You have the developer/:user_name/delete route set to use delete as the method, rather than get Since browsers usually don't support sending requests other than post or get, you'll need to pass a _method=delete parameter to that route Check out the rails guide on routing for more information:

[Rails] Re: Rails 3 routes.

2012-01-20 Thread Tim Shaffer
It depends how you generate the controller. If you use a command like this: rails g controller posts index show edit new update create destroy It will indeed create a GET route for each action. Kind of annoying. You can generate the restful controller and route declaration by using the

Re: [Rails] update data to database

2012-01-17 Thread Tim Shaffer
Just a note that you should be careful using this method to increment a value. It can cause a race condition. A safer method is to use increment_counter since it updates the value directly in the database, not using the current attribute value on the instance

Re: [Rails] html inside of erb

2012-01-16 Thread Tim Shaffer
The problem is that the inner string is not marked as html_safe. In your link_to tag, this string is not considered html_safe: link_to(*rights.controller + raquo; + rights.action*, :controller = rights, :action = edit, :id = rights.id) Colin's suggestion, which is the solution, is to

[Rails] Re: Correct syntax for prompt for select_tag

2012-01-16 Thread Tim Shaffer
Try this: :include_blank = Please select -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ysC9cdWs6J8J. To post to this group, send email to

[Rails] Re: Correct syntax for prompt for select_tag

2012-01-16 Thread Tim Shaffer
Try this. You can pass a string to include_blank :include_blank = Please select -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/r-jglcjPF-IJ. To

[Rails] Re: Correct syntax for prompt for select_tag

2012-01-16 Thread Tim Shaffer
The :prompt option was not added until rails 3.1.0 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/cSLW0PgNtgcJ. To post to this group, send email

[Rails] Re: displaying rails form validation errors inline

2012-01-11 Thread Tim Shaffer
What does your view look like? Do you have any error message related code in there? What does the output HTML look like? Is the error message repeated in the HTML? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion

[Rails] Re: how to make normal user as admin

2012-01-10 Thread Tim Shaffer
The easiest way is probably to just have a boolean is_admin field on the user model. Really depends on your other requirements though. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: How to set different id in nested form attributes

2012-01-04 Thread Tim Shaffer
How did all the children end up with the same ID? Posting some of your problematic code can help us help you. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Rails 3.1 assets pipeline issue in production

2012-01-04 Thread Tim Shaffer
If you don't want them to be compiled, you can just put them directly in the public/assets folder instead of in app/assets -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Am I having an asset problem?

2011-12-29 Thread Tim Shaffer
They are not compressed because you have config.assets.debug = true Kind of strange though that they are in the wrong order. What does your javascript_include_tag look like, and what do the files it's calling look like? -- You received this message because you are subscribed to the Google

[Rails] Re: ApplicationController needs a #delete method

2011-12-29 Thread Tim Shaffer
I apologize... I guess I wasn't sure what you were asking. ActionController::Base doesn't have *any* methods included. Not even the index, new, edit, etc. The only methods available are the ones you add in your application. So adding delete method to ActionController doesn't really make sense.

[Rails] Re: ApplicationController needs a #delete method

2011-12-28 Thread Tim Shaffer
You can easily add a delete method to your controller: def delete @post = Post.find(params[:id]) end Then add it to your routes as well: resources :posts do get 'delete', :on = :member end And you're done -- You received this message because you are subscribed to the Google Groups Ruby

[Rails] Re: how to change Root_path after user sign in ?

2011-12-22 Thread Tim Shaffer
You could just have your welcome#index action redirect to another controller/action if the user is signed in. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: what do you think it's better for pagination?

2011-12-09 Thread Tim Shaffer
I've used both, but prefer kaminari. I like kaminari's concept of scopes and using views rather than the method will_paginate uses. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

Re: [Rails] doubts with link_to function

2011-12-09 Thread Tim Shaffer
report_listing_path will return the path to whatever route you have defined as report_listing You can run rake routes from the command line to see which routes you have configured in your application. -- You received this message because you are subscribed to the Google Groups Ruby on Rails:

[Rails] Re: Dynamical refresh div with in rails

2011-11-01 Thread Tim Shaffer
No rails necessary. Check out the timeago jQuery plugin. http://timeago.yarp.com/ -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Mr_ShXivZOUJ.

[Rails] Re: Problem updating helper

2011-11-01 Thread Tim Shaffer
Did you restart rails on the production server after you updated the file? The old version is probably being cached. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Migration reports success but did not do anything

2011-10-31 Thread Tim Shaffer
So whenever you migrate down and back up it works? Sounds like the migration is working properly then. Under what circumstances does it not work? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: nested routes not rendering properly in link helper

2011-10-31 Thread Tim Shaffer
On Sunday, October 30, 2011 9:31:50 PM UTC-4, John Merlino wrote: get send_activation_notification = :send_activation_notification, :as = send_activation do resources :users do resources :accounts end end But it doesn't work for me. Note that

[Rails] Re: Quick and Dirty SSL for a Rails app

2011-10-28 Thread Tim Shaffer
Well provided you don't have any code in your application that won't work with https, you should be good to go. Just make sure the domain you are using to access your Rails application is SSL protected (via Apache, load balancer, or other means) and then simply access it using https. -- You

[Rails] Re: How to make comment with jquery

2011-10-28 Thread Tim Shaffer
What do you mean by comment? Commenting your code? In that case you can just use a JavaScript comment: // this is a comment /* this is also a comment */ -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web

[Rails] Re: additional model attributes

2011-10-25 Thread Tim Shaffer
I think for Rails to recognize that the attribute should be included, you need to use attr_accessible rather than the Ruby method attr_accessor. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Customizing errors

2011-10-25 Thread Tim Shaffer
error.full_messages does indeed call human_attribute_name. Did you check the source for that method in the link you posted? http://ar.rubyonrails.org/classes/ActiveRecord/Errors.html#M000311 full_messages @base.class.human_attribute_name(attr) + + msg -- You received this message because

[Rails] Re: add an array to params

2011-10-21 Thread Tim Shaffer
On Friday, October 21, 2011 3:53:33 AM UTC-4, Ruby-Forum.com User wrote: But there is something wrong. Does someone can help me? Probably. What is wrong? Are you getting any error messages? Have you checked out what params looks like in your controller (puts params.inspect)? -- You received

[Rails] Re: How to transform my html form into a rails 3 form

2011-10-21 Thread Tim Shaffer
Have a look at the documentation for check_box_tag http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-check_box_tag It specifies that any other keys passed to options will be used as HTML attributes. So you can pass your onclick attribute to check_box_tag in the

[Rails] Re: Active record, postgresql sequences and primary keys

2011-10-21 Thread Tim Shaffer
On Friday, October 21, 2011 2:57:56 PM UTC-4, Ruby-Forum.com User wrote: Task: I want use postgresql sequence for generation of primary key. I use 'set_sequence_name', but this don't work. What part of it does not work? Are you getting any error messages? -- You received

[Rails] Re: Generate model from database

2011-10-20 Thread Tim Shaffer
Well you don't exactly have to do it by *hand*. It's pretty easy to write a script to generate the command for you. Just change table_name to whatever your model is... table_name = Post output = [ rails g scaffold #{table_name} --skip-migration ] ignore_columns = [ 'id', 'created_at',

[Rails] Re: Access other model attributes directly with has_one, belongs_to ?

2011-10-20 Thread Tim Shaffer
I think what you're looking for is delegate which is a rails extension to Module: http://api.rubyonrails.org/classes/Module.html#method-i-delegate class ModelC ActiveRecord::Base has_many :model_a end class ModelA ActiveRecord::Base belongs_to :model_c delegate :version, :to = :model_c

Re: [Rails] Re: Generate model from database

2011-10-19 Thread Tim Shaffer
I believe you can also pass a --skip-migration option to scaffold so it won't generate the migration. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Fallback for CDN asset loading

2011-10-18 Thread Tim Shaffer
Gotcha. You could always create a helper for it. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/HweoZagzy1cJ. To post to this group, send email

[Rails] Re: adding key/value pairs to hash wrongfully adds a right bracket

2011-10-17 Thread Tim Shaffer
How do you call the session_code method? What data type are unit_id and code? And what does a typical session[:code] look like? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Fallback for CDN asset loading

2011-10-17 Thread Tim Shaffer
Why not just something like this? Then you can put your dojo.js in assets/javascripts and compile it like normal. Seems kind of unnecessary to add extra logic to javascript_include_tag %= javascript_include_tag http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js; % script

[Rails] Re: Validates_with problem

2011-10-14 Thread Tim Shaffer
On Friday, October 14, 2011 2:53:20 AM UTC-4, Ruby-Forum.com User wrote: I have one big problem: when I try record to db through update_attributes! (which must save when record invalid). I'm not so sure that's entirely accurate. Check out the API for update_attributes! and save! methods:

[Rails] Re: AJAX vote update for a nested resource

2011-10-14 Thread Tim Shaffer
You're defining @review as an instance variable, so you have to use it as one in the view: $(#votes).html(%= *@*review.votes_count %) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: how call method from model to controller in rails 3

2011-10-14 Thread Tim Shaffer
Now you have the opposite problem... You are now calling list as an instance method and you have it defined as a class method. You need to do ONE of the following. Define it as a class method, and call it as a class method: def self.list code end @list = Sale.list Define it as an instance

[Rails] Re: AJAX vote update for a nested resource

2011-10-14 Thread Tim Shaffer
That's to be expected with your HTML. What you currently have will generate HTML that looks like the following if you have 3 reviews: p id='votes'1 vote/p p id='votes'2 votes/p p id='votes'3 votes/p $(#votes).html(3 votes) $(#votes).html(4 votes) $(#votes).html(5 votes) See the problem? The

[Rails] Re: how to avoid the asset path warming

2011-10-12 Thread Tim Shaffer
Those are not warnings at all. Just normal log messages. Your browser is requesting the js, css, and jpg files with a conditional GET. The server is returning HTTP status code 304 since the file has not been modified since the last time the browser accessed. This is just a log of that

[Rails] Reload data set after AJAX creation?

2011-10-12 Thread Tim Shaffer
Let's say I have a controller with 2 collection actions for viewing tasks (accessed by /tasks/active and tasks/complete respectively). def active @tasks = Task.all(:complete = false) respond_with(@tasks) end def complete @tasks = Task.all(:complete = true)

[Rails] Re: update_attribute - effecting multiple attributes

2011-10-12 Thread Tim Shaffer
What does your User class look like? You might have something else in there that's firing before save. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

Re: [Rails] Re: Simple ActiveRecord serialise problem

2011-10-06 Thread Tim Shaffer
You're using the syntax of serialize properly. The problem looks like it's in the JSON.load method not properly handling a nil value: def load(source, proc = nil) if source.respond_to? :to_str source = source.to_str elsif source.respond_to? :to_io source = source.to_io.read else

[Rails] Re: Rails 3 routes with same name, different param name based on constraint

2011-10-06 Thread Tim Shaffer
Seems like it would be a lot easier to just have the logic in the controller. Right now you have the logic in the routes, then you'll also need logic in the controller to check whether params[:id] or params[:site_photo_id] exists. If you have just one route and move the logic to the

Re: [Rails] Jquery error please help me out

2011-10-04 Thread Tim Shaffer
If he is using Rails 3.1 it's not necessary to manually include the jQuery library using a script tag. It's also not necessary to manually include application.js like he is doing. It's better to use the asset pipeline. Make sure your Gemfile contains the following line: gem 'jquery-rails'

[Rails] Re: problem with dynamic values in popup box

2011-10-04 Thread Tim Shaffer
What does the value of your @employee variable look like. Where do you assign it? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/m94o6iq5IUEJ.

[Rails] Re: how to set .js file loading in 3.1?

2011-10-03 Thread Tim Shaffer
What do you mean by How can .js files be 'required' in other .js files? That's not really the way JavaScript works. What exactly are you trying to do? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web

[Rails] Re: gsubbing on a view/symbol

2011-09-30 Thread Tim Shaffer
The :modified_strategy is just a symbol that tells the helper which method to call on your object to get the name/value of the textarea. If you want to manually change the value of the textarea, you can overwrite the value attribute: f.text_area(:modify_strategy , :value =

[Rails] Re: I have problem installing rails

2011-09-30 Thread Tim Shaffer
Most likely the location of the rails executable is not in your path. What does your path variable look like? echo $PATH -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Simple question

2011-09-30 Thread Tim Shaffer
Technically I think it should still work but it's even easier in 3 match 'about', :to = 'info#about', :as = :about match 'contact', :to = 'info#contact', :as = :contact match 'privacy', :to = 'info#privacy', :as = :privacy -- You received this message because you are subscribed to the Google

[Rails] Re: Spatial data in rails on postgresql without BIG adapter?

2011-09-30 Thread Tim Shaffer
What data type is the position column in your database? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/aj7wLKhPGKgJ. To post to this group, send

[Rails] Re: Rails 3.1.0 how to pass the full url of an image asset ?

2011-09-26 Thread Tim Shaffer
Something like this should do the trick. You can just add this as a helper. def asset_url(source) #{request.protocol}#{request.host}#{asset_path(source)} end -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the

[Rails] Re: Sorting an array using relationships

2011-09-23 Thread Tim Shaffer
Can't you just add the status to the order clause? :order = status asc, messages.created_at desc -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

[Rails] Re: Sorting an array using relationships

2011-09-23 Thread Tim Shaffer
I believe in MySQL and PostgreSQL you can do something like this: order by status in (1,4,5,6,2,3,8,9,7) asc Which would translate to something like this in Rails: :order = status in (1,4,5,6,2,3,8,9,7) asc, messages.created_at desc Not sure if that will work verbatim though. You might have to

[Rails] Re: custom action in Rails 3

2011-09-22 Thread Tim Shaffer
That query is nothing to worry about. It's just rails running a query to figure out which tables you have in your database so it can figure out which columns they have so it can make your models work properly. In production it should only run once (when the server is first started). But then

[Rails] Re: problem with submit button in rails 3

2011-09-21 Thread Tim Shaffer
Do you have a controller named ProductsController? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/sUuMsWHWdxoJ. To post to this group, send email

[Rails] Re: problem with submit button in rails 3

2011-09-21 Thread Tim Shaffer
It's Rails convention that controllers should use the plural name of the model, like Product*s*Controller You could probably make it work by using the singular name of the model, but it would go against convention and wouldn't be very easy to maintain. -- You received this message because you

[Rails] Re: custom action in Rails 3

2011-09-21 Thread Tim Shaffer
You have the route specified to only accept POST requests, but by using link_to, you're creating a hyperlink that generates a GET request. You'll need to either change your routes to accept a GET request, or change your method of calling the URL to a POST request (from a form). -- You

[Rails] Re: Sorting an array using relationships

2011-09-20 Thread Tim Shaffer
Why are you storing the comment date in a separate table? The code you had is pretty close. Assuming you have a posted_date on the comments_date model, and the commends model has_one(:comments_date): @comments.sort do |c| c.comments_date.posted_date end -- You received this message because

[Rails] Re: 3.1 asset pipeline + Capistrano troubles

2011-09-19 Thread Tim Shaffer
Check out the guide on pre-compiling: http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets The default matcher for compiling files includes application.js, application.css and all files that do not end in js or css If you have other manifests or individual stylesheets and

[Rails] Re: 3.1 asset pipeline + Capistrano troubles

2011-09-19 Thread Tim Shaffer
If you have config.assets.compile set to true (typical for development) the stylesheet_link_tag will attempt to look in your app/assets directory and compile the css file if necessary. But the stylesheet_link_tag doesn't look outside public/assets in when config.assets.compile is set to false

Re: [Rails] problem with replacing div with partial page

2011-09-19 Thread Tim Shaffer
replace_html is a Prototype helper and has been deprecated in Rails 3.1 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/TGE1y-zZsy0J. To post to

[Rails] Re: problem with replacing div with partial page

2011-09-19 Thread Tim Shaffer
First of all it looks like you have a syntax error in the JavaScript: $.(#search_new) should be $(#search_new) If that doesn't fix the issue, there still might be something else wrong. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To

[Rails] Re: routing question

2011-09-19 Thread Tim Shaffer
Check out the guide for routing, especially the part on specifying a controller to use under customizing restful resources http://guides.rubyonrails.org/routing.html#customizing-resourceful-routes -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk

Re: [Rails] Re: splitted class into separate table activerecord

2011-09-19 Thread Tim Shaffer
You can also use the Rails delegate feature. I know you said you didn't want to create the the AuthInfo model but I'm not sure there's any harm to it? class User has_one :auth_info delegate :username, :username=, :password, :password=, :to = :auth_info end class AuthInfo belongs_to :user

[Rails] Re: can't convert Symbol into Integer rails textfieldtag

2011-09-19 Thread Tim Shaffer
Perhaps take a look at line 4. You're referencing :params[:search] but params is not a symbol. I think perhaps you meant params[:search -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

Re: [Rails] Help with default resource routes using id arguments

2011-09-16 Thread Tim Shaffer
If you want to redirect to a specific user_profile, you probably want to use the singular helper: user_profile_path(4) The singular path accepts 2 arguments: id and format The plural helper (user_profiles_path) is for the index action and only accepts 1 argument: format Run rake:routes to

[Rails] Re: Find a record in a find array

2011-09-16 Thread Tim Shaffer
I'm not quite sure what you're getting at here. If you have a model named Post, you could easily find the record with ID of 10 by doing the following: Post.find(10) But if you truly do have an array of post instances, you can find the one with ID of 10 using Enumerable.find: array_name.find

[Rails] Re: Browser compatibility Issue : Upload and Preview using Paperclip

2011-09-15 Thread Tim Shaffer
You basically need to preview an input type=file before it has been submitted? This sounds more like a JavaScript question than a Rails question. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit

  1   2   3   4   >